Bluemage/schemas/migrations/20240804155710_create_subreddits_table.sql

21 lines
632 B
SQL

-- +goose Up
-- +goose StatementBegin
CREATE TABLE subreddits (
name VARCHAR(30) NOT NULL PRIMARY KEY COLLATE NOCASE,
disabled TINYINT NOT NULL DEFAULT 0,
"type" VARCHAR(5) NOT NULL DEFAULT 'r',
schedule VARCHAR(20) NOT NULL DEFAULT '@daily',
countback BIGINT NOT NULL DEFAULT 300,
cover_image_id INTEGER,
created_at BIGINT DEFAULT (strftime('%s', 'now')) NOT NULL,
updated_at BIGINT DEFAULT (strftime('%s', 'now')) NOT NULL
);
CREATE UNIQUE INDEX idx_subreddits_name ON subreddits(name);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE subreddits;
-- +goose StatementEnd