sky/migrations/00004_drafts.sql
root 6ed55254a0 chore: initial import of sky project
Go + PostgreSQL + Valkey backend (cmd/internal/migrations),
uni-app mobile frontend, PC web (web/), admin console (admin/),
Android WebView container (android_project/).
Build artifacts, node_modules, local env and debug screenshots excluded.
2026-11-09 22:22:44 +08:00

14 lines
544 B
SQL

-- +goose Up
CREATE TABLE IF NOT EXISTS article_drafts (
id UUID PRIMARY KEY,
article_id UUID NOT NULL REFERENCES articles(id) ON DELETE CASCADE,
title TEXT NOT NULL DEFAULT '',
sections_json JSONB NOT NULL DEFAULT '[]'::jsonb,
client_saved_at TIMESTAMPTZ NOT NULL DEFAULT now(),
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_drafts_article_created ON article_drafts (article_id, created_at DESC);
-- +goose Down
DROP TABLE IF EXISTS article_drafts;