admin order line
This commit is contained in:
8
db.py
8
db.py
@@ -25,6 +25,7 @@ def init_db():
|
||||
payload TEXT NOT NULL, -- JSON string
|
||||
status TEXT NOT NULL DEFAULT 'pending', -- pending | executing | done | failed
|
||||
result_msg TEXT,
|
||||
position INTEGER, -- manual sort order for build queue (lower = first)
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
)
|
||||
@@ -75,6 +76,7 @@ def init_db():
|
||||
'ALTER TABLE town_state ADD COLUMN y REAL',
|
||||
'ALTER TABLE town_state ADD COLUMN sea INTEGER',
|
||||
'ALTER TABLE commands ADD COLUMN player_id TEXT',
|
||||
'ALTER TABLE commands ADD COLUMN position INTEGER',
|
||||
'ALTER TABLE farm_settings ADD COLUMN bandit_camp_enabled INTEGER NOT NULL DEFAULT 0',
|
||||
"ALTER TABLE clan_members ADD COLUMN features TEXT NOT NULL DEFAULT 'farm,admin'",
|
||||
'ALTER TABLE users ADD COLUMN clan_id INTEGER REFERENCES clans(id)',
|
||||
@@ -84,6 +86,12 @@ def init_db():
|
||||
except Exception:
|
||||
pass # column already exists
|
||||
|
||||
# Back-fill position for existing rows that have NULL position
|
||||
try:
|
||||
c.execute('UPDATE commands SET position = id WHERE position IS NULL')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Users — website admin accounts
|
||||
c.execute('''
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
|
||||
Reference in New Issue
Block a user