21 lines
540 B
MySQL
21 lines
540 B
MySQL
|
-- +goose Up
|
||
|
-- +goose StatementBegin
|
||
|
SELECT 'up SQL query';
|
||
|
create table if not exists chat_members
|
||
|
(
|
||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||
|
is_admin INTEGER DEFAULT 0,
|
||
|
chat_id INTEGER NOT NULL,
|
||
|
user_id INTEGER NOT NULL,
|
||
|
created INTEGER NOT NULL,
|
||
|
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE,
|
||
|
FOREIGN KEY (chat_id) REFERENCES chats (id) ON DELETE CASCADE
|
||
|
);
|
||
|
-- +goose StatementEnd
|
||
|
|
||
|
-- +goose Down
|
||
|
-- +goose StatementBegin
|
||
|
SELECT 'down SQL query';
|
||
|
drop table chat_members;
|
||
|
-- +goose StatementEnd
|