update schema test and minify migration
Sonarqube Scanner / Build and analyze (push) Failing after 1m7s

This commit is contained in:
Florian Zumpe
2026-09-02 00:58:24 +02:00
parent a66482a137
commit 4b1b6eeced
2 changed files with 9 additions and 6 deletions
@@ -1,3 +1,3 @@
-- Ergänzt den manuellen Freigabezeitpunkt für Strecken.
-- Neue Strecken bleiben unveröffentlicht, solange activated_at is NULL.
ALTER TABLE routes ADD COLUMN activated_at TEXT NULL DEFAULT NULL;
ALTER TABLE routes ADD COLUMN activated_at TEXT DEFAULT NULL;
+7 -4
View File
@@ -12,10 +12,13 @@ async function read(relativePath) {
test('initial database schema creates routes with a nullable activation timestamp', async () => {
const schema = await read('database/schema.sql');
const migration = await read('database/migrations/20260901_add_route_activated_at.sql');
const routeTable = schema.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?routes\s*\([\s\S]*?\);/i);
const routeTable = schema.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?routes\s*\([\s\S]*?\)\s+STRICT\s*;/i);
assert.ok(routeTable, 'database/schema.sql must define the routes table');
assert.match(routeTable[0], /\bactivated_at\s+DATETIME\s+NULL\b/i);
assert.match(migration, /ALTER\s+TABLE\s+routes\s+ADD\s+COLUMN\s+activated_at\s+DATETIME\s+NULL/i);
assert.ok(routeTable, 'database/schema.sql must define the routes table as a STRICT SQLite table');
assert.match(routeTable[0], /\bactivated_at\s+TEXT\s+(?:NULL\s+)?DEFAULT\s+NULL\b/i);
assert.doesNotMatch(routeTable[0], /\bactivated_at\s+DATETIME\b/i);
assert.match(migration, /ALTER\s+TABLE\s+routes\s+ADD\s+COLUMN\s+activated_at\s+TEXT\s+(?:NULL\s+)?DEFAULT\s+NULL/i);
assert.doesNotMatch(migration, /\bactivated_at\s+DATETIME\b/i);
assert.match(migration, /Neue Strecken bleiben unveröffentlicht|unpublished|activated_at is NULL/i);
});