mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-09-07 15:05:33 +08:00
27 lines
705 B
SQL
27 lines
705 B
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
|
|
CREATE TABLE teldrive.bots (
|
|
user_id bigint NOT NULL,
|
|
token text NOT NULL,
|
|
bot_user_name text NOT NULL,
|
|
bot_id bigint NOT NULL,
|
|
FOREIGN KEY (user_id) REFERENCES teldrive.users(user_id),
|
|
CONSTRAINT btoken_user_un UNIQUE (user_id,token)
|
|
);
|
|
|
|
CREATE TABLE teldrive.channels (
|
|
channel_id bigint NOT NULL PRIMARY KEY,
|
|
channel_name text NOT NULL,
|
|
user_id bigint NOT NULL,
|
|
selected boolean DEFAULT false,
|
|
FOREIGN KEY (user_id) REFERENCES teldrive.users(user_id)
|
|
);
|
|
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
DROP TABLE IF EXISTS teldrive.bots;
|
|
DROP TABLE IF EXISTS teldrive.channels;
|
|
-- +goose StatementEnd
|