tg_rss_bot/migrations/0000.initial_schema.py
mitsuha_s 90c93528ec
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
add indentation in sql queries
2022-08-21 23:03:43 +03:00

30 lines
697 B
Python

from yoyo import step
steps = [
step(
'CREATE TABLE users ('
' id SERIAL PRIMARY KEY,'
' telegram_id INTEGER NOT NULL UNIQUE'
')'
),
step('CREATE TABLE feeds ('
' id SERIAL PRIMARY KEY,'
' url TEXT NOT NULL UNIQUE'
')'
),
step(
'CREATE TABLE subscriptions ('
' user_id INTEGER REFERENCES users,'
' feed_id INTEGER REFERENCES feeds,'
' UNIQUE (user_id, feed_id)'
')'
),
step(
'CREATE TABLE feeds_last_items ('
' feed_id INTEGER REFERENCES feeds ON DELETE CASCADE,'
' url TEXT NOT NULL,'
' guid TEXT'
')'
)
]