Changes between Version 4 and Version 5 of phase0


Ignore:
Timestamp:
03/06/24 23:55:02 (3 months ago)
Author:
201166
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • phase0

    v4 v5  
    2727----
    2828
    29 create table category
     29create table category\\
    3030(
    31     id          bigserial primary key,
    32     name        varchar(255),
    33     category_id bigint references category (id)
    34         on delete cascade
    35         on update cascade
    36 );
     31    id          bigserial primary key,\\
     32    name        varchar(255),\\
     33    category_id bigint references category (id)\\
     34        on delete cascade\\
     35        on update cascade\\
     36);\\
    3737
    3838----
    3939
    40 create table supplier
    41 (
    42     id           bigserial primary key,
    43     name         varchar(255),
    44     location     varchar(255),
    45     phone_number varchar(255)
    46 );
     40create table supplier\\
     41(\\
     42    id           bigserial primary key,\\
     43    name         varchar(255),\\
     44    location     varchar(255),\\
     45    phone_number varchar(255)\\
     46);\\
    4747
    4848----
    4949
    50 create table product
    51 (
    52     id          bigserial primary key,
    53     name        varchar(255),
    54     description varchar(255),
    55     image       bytea,
    56     quantity    integer,
    57     category_id bigint references category (id)
    58         on delete set null
    59         on update cascade,
    60     supplier_id bigint references supplier (id)
    61         on delete set null
    62         on update cascade
    63 );
     50create table product\\
     51(\\
     52    id          bigserial primary key,\\
     53    name        varchar(255),\\
     54    description varchar(255),\\
     55    image       bytea,\\
     56    quantity    integer,\\
     57    category_id bigint references category (id)\\
     58        on delete set null\\
     59        on update cascade,\\
     60    supplier_id bigint references supplier (id)\\
     61        on delete set null\\
     62        on update cascade\\
     63);\\
    6464
    6565----
    6666
    67 create table product_price
    68 (
    69     product_id bigint,
    70     price      integer,
    71     start_date date,
    72     end_date   date,
    73     foreign key (product_id) references product (id)
    74         on delete cascade
    75         on update cascade,
    76     primary key (product_id, price, start_date),
    77     check ( price > 0 ),
    78     check ( end_date >= start_date )
    79 );
     67create table product_price\\
     68(\\
     69    product_id bigint,\\
     70    price      integer,\\
     71    start_date date,\\
     72    end_date   date,\\
     73    foreign key (product_id) references product (id)\\
     74        on delete cascade\\
     75        on update cascade,\\
     76    primary key (product_id, price, start_date),\\
     77    check ( price > 0 ),\\
     78    check ( end_date >= start_date )\\
     79);\\
    8080
    8181----
    8282
    8383
    84 create table property
    85 (
    86     id   bigserial primary key,
    87     name varchar(255)
    88 );
     84create table property\\
     85(\\
     86    id   bigserial primary key,\\
     87    name varchar(255)\\
     88);\\
    8989
    9090----
    9191
    92 create table product_property
    93 (
    94     product_id  bigint,
    95     property_id bigint,
    96     value       varchar(255),
    97     foreign key (product_id) references product (id)
    98         on delete cascade
    99         on update cascade,
    100     foreign key (property_id) references property (id)
    101         on delete cascade
    102         on update cascade,
    103     primary key (product_id, property_id)
    104 );
     92create table product_property\\
     93(\\
     94    product_id  bigint,\\
     95    property_id bigint,\\
     96    value       varchar(255),\\
     97    foreign key (product_id) references product (id)\\
     98        on delete cascade\\
     99        on update cascade,\\
     100    foreign key (property_id) references property (id)\\
     101        on delete cascade\\
     102        on update cascade,\\
     103    primary key (product_id, property_id)\\
     104);\\
    105105
    106106----
    107107
    108 create table orders
     108create table orders\\
    109109(
    110     id      bigserial primary key,
    111     status  varchar(255),
    112     date    date,
    113     price   integer,
    114     user_id bigint,
    115     foreign key (user_id) references users (id)
    116         on delete set null
    117         on update cascade
    118 );
     110    id      bigserial primary key,\\
     111    status  varchar(255),\\
     112    date    date,\\
     113    price   integer,\\
     114    user_id bigint,\\
     115    foreign key (user_id) references users (id)\\
     116        on delete set null\\
     117        on update cascade\\
     118);\\
    119119
    120120----
    121121
    122 create table order_details
    123 (
    124     order_id   bigint,
    125     product_id bigint,
    126     quantity   integer,
    127     foreign key (order_id) references orders (id)
    128         on delete cascade
    129         on update cascade,
    130     foreign key (product_id) references product (id)
    131         on delete cascade
    132         on update cascade,
    133     primary key (order_id, product_id)
    134 );
     122create table order_details\\
     123(\\
     124    order_id   bigint,\\
     125    product_id bigint,\\
     126    quantity   integer,\\
     127    foreign key (order_id) references orders (id)\\
     128        on delete cascade\\
     129        on update cascade,\\
     130    foreign key (product_id) references product (id)\\
     131        on delete cascade\\
     132        on update cascade,\\
     133    primary key (order_id, product_id)\\
     134);\\