Bluemage/schemas/migrations/20240804155710_create_subreddits_table.sql

21 lines
641 B
MySQL
Raw Normal View History

2024-08-04 23:16:05 +07:00
-- +goose Up
-- +goose StatementBegin
CREATE TABLE subreddits (
name VARCHAR(30) NOT NULL PRIMARY KEY COLLATE NOCASE,
2024-08-05 23:06:32 +07:00
disable_scheduler TINYINT NOT NULL DEFAULT 0,
2024-08-04 23:16:05 +07:00
"type" VARCHAR(5) NOT NULL DEFAULT 'r',
schedule VARCHAR(20) NOT NULL DEFAULT '@daily',
2024-08-09 15:22:54 +07:00
countback BIGINT NOT NULL DEFAULT 300,
cover_image_id INTEGER,
2024-08-05 23:06:32 +07:00
created_at BIGINT DEFAULT (strftime('%s', 'now')) NOT NULL,
updated_at BIGINT DEFAULT (strftime('%s', 'now')) NOT NULL
2024-08-04 23:16:05 +07:00
);
CREATE UNIQUE INDEX idx_subreddits_name ON subreddits(name);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE subreddits;
-- +goose StatementEnd