summaryrefslogtreecommitdiff
path: root/db/migrations/0157_oval_sunfire.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations/0157_oval_sunfire.sql')
-rw-r--r--db/migrations/0157_oval_sunfire.sql14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/migrations/0157_oval_sunfire.sql b/db/migrations/0157_oval_sunfire.sql
new file mode 100644
index 00000000..71cb063f
--- /dev/null
+++ b/db/migrations/0157_oval_sunfire.sql
@@ -0,0 +1,14 @@
+CREATE TABLE "project_gtc_files" (
+ "id" serial PRIMARY KEY NOT NULL,
+ "project_id" integer NOT NULL,
+ "file_name" varchar(255) NOT NULL,
+ "file_path" varchar(1024) NOT NULL,
+ "original_file_name" varchar(255) NOT NULL,
+ "file_size" integer,
+ "mime_type" varchar(100),
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+ALTER TABLE "project_gtc_files" ADD CONSTRAINT "project_gtc_files_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
+CREATE VIEW "public"."project_gtc_view" AS (select "projects"."id" as "id", "projects"."code" as "code", "projects"."name" as "name", "projects"."type" as "type", "projects"."created_at" as "project_created_at", "projects"."updated_at" as "project_updated_at", "project_gtc_files"."id" as "gtc_file_id", "project_gtc_files"."file_name" as "fileName", "project_gtc_files"."file_path" as "filePath", "project_gtc_files"."original_file_name" as "originalFileName", "project_gtc_files"."file_size" as "fileSize", "project_gtc_files"."mime_type" as "mimeType", "project_gtc_files"."created_at" as "gtcCreatedAt", "project_gtc_files"."updated_at" as "gtcUpdatedAt" from "projects" left join "project_gtc_files" on "projects"."id" = "project_gtc_files"."project_id"); \ No newline at end of file