API für Geo Positions Update mit Testscript
This commit is contained in:
1 parent
23a9df66f4
commit
d54a986c14
16 files changed
+1027
-6
No files matched your search
@@ -90,6 +90,25 @@ def ensure_ws_schema(db):
|
||||
db.commit()
|
||||
|
||||
|
||||
def ensure_api_schema(db):
|
||||
"""Legt die Tabelle für die externen API-Zugriffstoken an."""
|
||||
db.executescript('''
|
||||
CREATE TABLE IF NOT EXISTS api_tokens (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
tenant_id INTEGER NOT NULL,
|
||||
token TEXT UNIQUE NOT NULL,
|
||||
created_by_account_id INTEGER,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id),
|
||||
FOREIGN KEY (created_by_account_id) REFERENCES accounts(id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_api_tokens_tenant
|
||||
ON api_tokens(tenant_id);
|
||||
''')
|
||||
db.commit()
|
||||
|
||||
|
||||
def ensure_schema():
|
||||
"""Ergänzt bestehende Datenbanken um das Gruppen-Account-Zuordnungsmodell.
|
||||
|
||||
@@ -100,6 +119,7 @@ def ensure_schema():
|
||||
"""
|
||||
db = get_db()
|
||||
ensure_ws_schema(db)
|
||||
ensure_api_schema(db)
|
||||
groups_table = db.execute(
|
||||
"SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'groups'"
|
||||
).fetchone()
|
||||
|
||||
Reference in new issue
Block a user