mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-26 19:21:43 +00:00
[SIS-xxx] adding rendering of current Debra donation information
updating for Debra 2023 campaign adding internal rest api for debra information adding a debra button to receive information
This commit is contained in:
22
python/tools/migrations/quotes-migration/main.py
Normal file
22
python/tools/migrations/quotes-migration/main.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from legacy_loader import create_connection, load_all_quotes_with_attachments
|
||||
from quote_importer import insert_quotes, create_users, create_channels
|
||||
import sqlalchemy as db
|
||||
import os
|
||||
|
||||
server_id = os.getenv('SERVER_ID')
|
||||
conn = create_connection('new_quotes.db')
|
||||
|
||||
all_quotes = load_all_quotes_with_attachments(conn)
|
||||
db_host = os.getenv('DB_HOST')
|
||||
db_port = os.getenv('DB_PORT')
|
||||
db_database = os.getenv('DB_NAME')
|
||||
db_user = os.getenv('DB_USER')
|
||||
db_password = os.getenv('DB_PASS')
|
||||
engine = db.create_engine('postgresql://%s:%s@%s:%s/%s' % (db_user, db_password, db_host, db_port, db_database))
|
||||
1
|
||||
with engine.connect() as con:
|
||||
with con.begin():
|
||||
create_users(server_id, all_quotes, con)
|
||||
create_channels(server_id, all_quotes, con)
|
||||
with con.begin():
|
||||
insert_quotes(server_id, all_quotes, con)
|
||||
Reference in New Issue
Block a user