naco-api/sql/schema/004_add_style_posts.sql

17 lines
No EOL
512 B
SQL

-- +goose up
CREATE TABLE IF NOT EXISTS user_style_posts (
id BIGSERIAL PRIMARY KEY,
user_id TEXT NOT NULL,
platform TEXT NOT NULL,
post_id TEXT NOT NULL,
post_text TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
UNIQUE (user_id, platform, post_id)
);
CREATE INDEX IF NOT EXISTS idx_user_style_posts_user_platform
ON user_style_posts (user_id, platform);
-- +goose down
DROP INDEX IF EXISTS idx_user_style_posts_user_platform;
DROP TABLE IF EXISTS user_style_posts;