blog/backend/migrations/20250801062344_create_image_table.sql
SquidSpirit ded3d6c363
All checks were successful
Frontend CI / build (push) Successful in 1m9s
Auto Comment On PR / add_improve_comment (pull_request) Successful in 17s
PR Title Check / pr-title-check (pull_request) Successful in 16s
BLOG-95 refactor: seperate sql migration files
2025-08-01 14:51:05 +08:00

13 lines
416 B
SQL

CREATE TABLE IF NOT EXISTS "image" (
"id" SERIAL PRIMARY KEY NOT NULL,
"mime_type" VARCHAR(100) NOT NULL,
"deleted_time" TIMESTAMP,
"created_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_time" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE OR REPLACE TRIGGER "update_image_updated_time"
BEFORE UPDATE ON "image"
FOR EACH ROW
EXECUTE FUNCTION update_updated_time_column();