Fix retrait DB migration + emojis panel
- db.py: Ajout migration ALTER TABLE pour colonne client_negative_floor (correction du bug 'no such column' sur les bases existantes) - panel.py: Tous les boutons du panel avec emojis - panel.py: Correction TextSelect -> TextDisplay (panel crash)
This commit is contained in:
parent
c37a2a0ff9
commit
ae451fe894
2 changed files with 48 additions and 38 deletions
10
utils/db.py
10
utils/db.py
|
|
@ -72,6 +72,11 @@ CREATE INDEX IF NOT EXISTS idx_institutions_guild ON institutions(guild_id);
|
|||
"""
|
||||
|
||||
|
||||
MIGRATIONS = [
|
||||
"ALTER TABLE banks ADD COLUMN client_negative_floor REAL DEFAULT 0.0",
|
||||
]
|
||||
|
||||
|
||||
async def get_db() -> aiosqlite.Connection:
|
||||
os.makedirs(os.path.dirname(DB_PATH), exist_ok=True)
|
||||
db = await aiosqlite.connect(DB_PATH)
|
||||
|
|
@ -79,5 +84,10 @@ async def get_db() -> aiosqlite.Connection:
|
|||
await db.execute("PRAGMA journal_mode=WAL")
|
||||
await db.execute("PRAGMA foreign_keys=ON")
|
||||
await db.executescript(SCHEMA)
|
||||
for migration in MIGRATIONS:
|
||||
try:
|
||||
await db.execute(migration)
|
||||
except Exception:
|
||||
pass
|
||||
await db.commit()
|
||||
return db
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue