
diff -r 49eb72a46208 -r 1fcbeae1f9da src/main/resources/db/db-schema.sql
--- a/src/main/resources/db/db-schema.sql	Thu May 24 11:19:26 2012 +0200
+++ b/src/main/resources/db/db-schema.sql	Wed May 30 22:51:02 2012 +0200
@@ -160,6 +160,19 @@
     "contact" bigint not null,
     "entity" bigint not null
   );
+create table "attachment" (
+    "name" varchar(100) not null,
+    "updated_at" timestamp not null,
+    "id" bigint primary key not null,
+    "mime_type" varchar(80) not null,
+    "content_id" varchar(20) not null,
+    "size" bigint not null,
+    "note" varchar(10240),
+    "created_at" timestamp not null,
+    "created_by" bigint,
+    "updated_by" bigint
+  );
+create sequence "attachment_id_seq";
 create table "project" (
     "id" bigint primary key not null,
     "name" varchar(100) not null,
@@ -210,6 +223,14 @@
     "location" bigint not null,
     "project" bigint not null
   );
+create table "project_attachment" (
+    "project" bigint not null,
+    "attachment" bigint not null
+  );
+create table "task_attachment" (
+    "task" bigint not null,
+    "attachment" bigint not null
+  );
 create table "service" (
     "name" varchar(100) not null,
     "updated_at" timestamp not null,
@@ -262,10 +283,16 @@
 alter table "project_company" add foreign key ("company") references "company"("id") on delete cascade;
 alter table "project_location" add foreign key ("project") references "project"("id") on delete cascade;
 alter table "project_location" add foreign key ("location") references "location"("id") on delete cascade;
+alter table "project_attachment" add foreign key ("project") references "project"("id") on delete cascade;
+alter table "project_attachment" add foreign key ("attachment") references "attachment"("id") on delete cascade;
+alter table "task_attachment" add foreign key ("task") references "task"("id") on delete cascade;
+alter table "task_attachment" add foreign key ("attachment") references "attachment"("id") on delete cascade;
 -- composite key indexes :
 alter table "company_contact" add unique("entity","contact");
 alter table "user_contact" add unique("entity","contact");
 alter table "project_company" add unique("project","company");
 alter table "project_location" add unique("project","location");
+alter table "project_attachment" add unique("project","attachment");
+alter table "task_attachment" add unique("task","attachment");
 -- column group indexes :
 create index "user_deleted_active_idx" on "user" ("deleted","active");




