From 55f57957190a266212ffab8dbbee2d1148232780 Mon Sep 17 00:00:00 2001 From: SoXX Date: Wed, 6 Nov 2024 11:22:22 +0100 Subject: [PATCH] feat(migration): added new PostReport model --- pkg/database/migrations/006_post_reports.sql | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 pkg/database/migrations/006_post_reports.sql diff --git a/pkg/database/migrations/006_post_reports.sql b/pkg/database/migrations/006_post_reports.sql new file mode 100644 index 0000000..18cb294 --- /dev/null +++ b/pkg/database/migrations/006_post_reports.sql @@ -0,0 +1,30 @@ +-- +migrate Up +CREATE TYPE ReportType AS ENUM ( + 'duplicate', + 'missing_data', + 'rating_abuse' + 'illegal_content' + ); + +CREATE TYPE ReportState AS ENUM ( + 'pending_unclaimed', + 'pending', + 'approved', + 'partial', + 'rejected' + ); + +CREATE TABLE "PostReport" +( + id CHAR(25) NOT NULL PRIMARY KEY, + created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP WITH TIME ZONE NULL, + post_id CHAR(25) NOT NULL REFERENCES "Post" (id), + report_by TEXT NOT NULL REFERENCES "User" (id), + report_description TEXT NOT NULL, + audit_by TEXT NULL REFERENCES "User" (id), + audit_description TEXT NOT NULL, + report_type ReportType NOT NULL, + report_state ReportState NOT NULL +); \ No newline at end of file