--- a/src/main/resources/db/db-schema.sql Wed May 09 22:53:03 2012 +0200
+++ b/src/main/resources/db/db-schema.sql Thu May 24 11:19:26 2012 +0200
@@ -210,6 +210,29 @@
"location" bigint not null,
"project" bigint not null
);
+create table "service" (
+ "name" varchar(100) not null,
+ "updated_at" timestamp not null,
+ "id" bigint primary key not null,
+ "to" timestamp,
+ "state" bigint not null,
+ "company" bigint not null,
+ "note" varchar(10240),
+ "from" timestamp not null,
+ "created_at" timestamp not null,
+ "created_by" bigint,
+ "updated_by" bigint
+ );
+create sequence "service_id_seq";
+create table "service_payment" (
+ "id" bigint primary key not null,
+ "service" bigint not null,
+ "direction" integer not null,
+ "period" bigint not null,
+ "amount" numeric(16,2) not null,
+ "currency" bigint not null
+ );
+create sequence "service_payment_id_seq";
-- foreign key constraints :
alter table "address" add foreign key ("city_id") references "city"("id");
alter table "city" add foreign key ("country_id") references "country"("id");
@@ -226,7 +249,12 @@
alter table "task" add foreign key ("state") references "code_list_item"("id");
alter table "task" add foreign key ("project_id") references "project"("id");
alter table "comment" add foreign key ("task_id") references "task"("id") on delete cascade;
+alter table "service" add foreign key ("company") references "company"("id");
+alter table "service" add foreign key ("state") references "code_list_item"("id");
alter table "company_contact" add foreign key ("entity") references "company"("id") on delete cascade;
+alter table "service_payment" add foreign key ("service") references "service"("id") on delete cascade;
+alter table "service_payment" add foreign key ("period") references "code_list_item"("id");
+alter table "service_payment" add foreign key ("currency") references "code_list_item"("id");
alter table "company_contact" add foreign key ("contact") references "contact"("id") on delete cascade;
alter table "user_contact" add foreign key ("entity") references "user"("id") on delete cascade;
alter table "user_contact" add foreign key ("contact") references "contact"("id") on delete cascade;