src/main/resources/db/schema-changes-0.2-0.3.sql
changeset 99 49eb72a46208
parent 98 eac38214183d
child 100 1fcbeae1f9da
equal deleted inserted replaced
98:eac38214183d 99:49eb72a46208
     6     "project" bigint not null
     6     "project" bigint not null
     7   );
     7   );
     8 alter table "project_location" add foreign key ("project") references "project"("id") on delete cascade;
     8 alter table "project_location" add foreign key ("project") references "project"("id") on delete cascade;
     9 alter table "project_location" add foreign key ("location") references "location"("id") on delete cascade;
     9 alter table "project_location" add foreign key ("location") references "location"("id") on delete cascade;
    10 alter table "project_location" add unique("project","location");
    10 alter table "project_location" add unique("project","location");
       
    11 
       
    12 -- service
       
    13 create table "service" (
       
    14     "name" varchar(100) not null,
       
    15     "updated_at" timestamp not null,
       
    16     "id" bigint primary key not null,
       
    17     "to" timestamp,
       
    18     "state" bigint not null,
       
    19     "company" bigint not null,
       
    20     "note" varchar(10240),
       
    21     "from" timestamp not null,
       
    22     "created_at" timestamp not null,
       
    23     "created_by" bigint,
       
    24     "updated_by" bigint
       
    25   );
       
    26 create sequence "service_id_seq";
       
    27 alter table "service" add foreign key ("company") references "company"("id");
       
    28 alter table "service" add foreign key ("state") references "code_list_item"("id");
       
    29 
       
    30 -- service payment
       
    31 create table "service_payment" (
       
    32     "id" bigint primary key not null,
       
    33     "service" bigint not null,
       
    34     "direction" integer not null,
       
    35     "period" bigint not null,
       
    36     "amount" numeric(16,2) not null,
       
    37     "currency" bigint not null
       
    38   );
       
    39 create sequence "service_payment_id_seq";
       
    40 alter table "service_payment" add foreign key ("service") references "service"("id") on delete cascade;
       
    41 alter table "service_payment" add foreign key ("period") references "code_list_item"("id");
       
    42 alter table "service_payment" add foreign key ("currency") references "code_list_item"("id");
       
    43