diff options
Diffstat (limited to 'migrations')
| -rw-r--r-- | migrations/2_create_subscription_tables.down.sql | 4 | ||||
| -rw-r--r-- | migrations/2_create_subscription_tables.up.sql | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/migrations/2_create_subscription_tables.down.sql b/migrations/2_create_subscription_tables.down.sql new file mode 100644 index 0000000..d9a369e --- /dev/null +++ b/migrations/2_create_subscription_tables.down.sql @@ -0,0 +1,4 @@ +DROP INDEX IF EXISTS user_email_table_email_uindex; +DROP TABLE IF EXISTS user_email_table; +DROP TABLE IF EXISTS subscription_user_to_tags_table; +DROP TABLE IF EXISTS subscription_tag_to_users_table; diff --git a/migrations/2_create_subscription_tables.up.sql b/migrations/2_create_subscription_tables.up.sql new file mode 100644 index 0000000..e6e905a --- /dev/null +++ b/migrations/2_create_subscription_tables.up.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS user_email_table ( + user_id VARCHAR(32) NOT NULL PRIMARY KEY, + email VARCHAR(64) NOT NULL, + lang VARCHAR(2) NOT NULL +) WITHOUT ROWID; + +CREATE UNIQUE INDEX user_email_table_email_uindex +ON user_email_table(email); + +CREATE TABLE IF NOT EXISTS subscription_user_to_tags_table ( + user_id VARCHAR(32) NOT NULL PRIMARY KEY, + tags TEXT NOT NULL +) WITHOUT ROWID; + +CREATE TABLE IF NOT EXISTS subscription_tag_to_users_table ( + tag VARCHAR(32) NOT NULL PRIMARY KEY, + user_ids TEXT NOT NULL +) WITHOUT ROWID; |