some changes?

This commit is contained in:
Aleksandr Trushkin
2024-05-01 16:51:07 +03:00
parent fb03a110ed
commit 41072b91d1
5 changed files with 305 additions and 185 deletions

View File

@ -1,5 +1,3 @@
BEGIN;
CREATE TABLE IF NOT EXISTS users (
`user_id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
`chat_id` integer NOT NULL UNIQUE,
@ -29,8 +27,6 @@ CREATE TABLE IF NOT EXISTS actions (
ON DELETE CASCADE
);
COMMIT;
-- drop index actions_action_id_user_id_idx;
-- drop table users;
-- drop table parameters;

12
db/002_subscribers.sql Normal file
View File

@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS `subscribers` (
`subscriber_id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`user_id` INTEGER NOT NULL,
`kind` VARCHAR(16) NOT NULL,
`arguments` JSON NOT NULL DEFAULT '{}',
FOREIGN KEY(`user_id`)
REFERENCES users(user_id)
ON DELETE CASCADE
);
CREATE UNIQUE INDEX IF NOT EXISTS subscribers_kind_user_id
ON subscribers (`kind`, `user_id`);