feat: add migrations, api bot endpoints and revamp the whole twitch backend by making use of twitchio
This commit is contained in:
parent
8799bab900
commit
4c534de47b
45 changed files with 1718 additions and 1109 deletions
29
migrations/20241213175820_auth.py
Normal file
29
migrations/20241213175820_auth.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""
|
||||
This module contains a Caribou migration.
|
||||
|
||||
Migration Name: auth
|
||||
Migration Version: 20241213175820
|
||||
"""
|
||||
|
||||
|
||||
def upgrade(connection):
|
||||
# add your upgrade step here
|
||||
sql = """
|
||||
create table users
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
user varchar(255) NOT NULL UNIQUE,
|
||||
access_token varchar(255) NOT NULL,
|
||||
refresh_token varchar(255) NOT NULL,
|
||||
expires_at TIMESTAMP NOT NULL,
|
||||
last_updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
"""
|
||||
connection.execute(sql)
|
||||
connection.commit()
|
||||
|
||||
|
||||
def downgrade(connection):
|
||||
# add your downgrade step here
|
||||
pass
|
||||
38
migrations/20241216204252_quotes.py
Normal file
38
migrations/20241216204252_quotes.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
"""
|
||||
This module contains a Caribou migration.
|
||||
|
||||
Migration Name: quotes
|
||||
Migration Version: 20241216204252
|
||||
"""
|
||||
|
||||
|
||||
def upgrade(connection):
|
||||
# add your upgrade step here
|
||||
sql = """
|
||||
create table quotes
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
quote varchar(255) NOT NULL UNIQUE,
|
||||
author varchar(255),
|
||||
channel varchar(255),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
last_updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
"""
|
||||
connection.execute(sql)
|
||||
sql = """
|
||||
create table sentences
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
sentence varchar(255) NOT NULL UNIQUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
last_updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
"""
|
||||
connection.execute(sql)
|
||||
connection.commit()
|
||||
|
||||
|
||||
def downgrade(connection):
|
||||
# add your downgrade step here
|
||||
pass
|
||||
28
migrations/20241217000747_settings.py
Normal file
28
migrations/20241217000747_settings.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"""
|
||||
This module contains a Caribou migration.
|
||||
|
||||
Migration Name: settings
|
||||
Migration Version: 20241217000747
|
||||
"""
|
||||
|
||||
|
||||
def upgrade(connection):
|
||||
sql = """
|
||||
create table settings(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
user_id VARCHAR(255) NOT NULL UNIQUE,
|
||||
automatic_generation_timer INTENGER NOT NULL DEFAULT 300,
|
||||
automatic_quote_timer INTEGER NOT NULL DEFAULT 500,
|
||||
mods VARCHAR(255),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
last_updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(user)
|
||||
);
|
||||
"""
|
||||
connection.execute(sql)
|
||||
connection.commit()
|
||||
|
||||
|
||||
def downgrade(connection):
|
||||
# add your downgrade step here
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue