feat: Initial commit for GrimHold with requirements and INSTALL.md
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
DB_PATH = "/home/maxi/Projekt/grimhold.waiswuaschd.de/data/grimhold.db"
|
||||
|
||||
def migrate():
|
||||
conn = sqlite3.connect(DB_PATH)
|
||||
cur = conn.cursor()
|
||||
cur.execute("PRAGMA table_info(users)")
|
||||
cols = [r[1] for r in cur.fetchall()]
|
||||
print("Users cols:", cols)
|
||||
|
||||
if "max_building_slots" not in cols:
|
||||
print("Adding max_building_slots column...")
|
||||
cur.execute("ALTER TABLE users ADD COLUMN max_building_slots INTEGER NOT NULL DEFAULT 8")
|
||||
|
||||
# Set existing maze_tiles outside 16x10 bounds to be deleted or trimmed so they don't break the new grid
|
||||
cur.execute("DELETE FROM maze_tiles WHERE x >= 16 OR y >= 10")
|
||||
print("Cleaned up tiles outside 16x10 bounds.")
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print("Migration successful!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
migrate()
|
||||
Reference in New Issue
Block a user