chore: initial baseline with P0-safety .gitignore
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import sqlite3
|
||||
conn = sqlite3.connect('it_smart_desk.db')
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Employee 表新增字段
|
||||
alterations = [
|
||||
("it_level", "VARCHAR(20)", "'silver'"),
|
||||
("it_level_source", "VARCHAR(20)", "'system'"),
|
||||
("notes", "JSON", "'{}'"),
|
||||
]
|
||||
|
||||
for col_name, col_type, default_val in alterations:
|
||||
try:
|
||||
cursor.execute(f"ALTER TABLE employees ADD COLUMN {col_name} {col_type} NOT NULL DEFAULT {default_val}")
|
||||
print(f"ADDED: employees.{col_name}")
|
||||
except sqlite3.OperationalError as e:
|
||||
if "duplicate column" in str(e).lower():
|
||||
print(f"SKIP: employees.{col_name} already exists")
|
||||
else:
|
||||
print(f"ERROR: employees.{col_name} — {e}")
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
print("Done.")
|
||||
Reference in New Issue
Block a user