update database schema and update editor script
Sonarqube Scanner / Build and analyze (push) Failing after 26s
Sonarqube Scanner / Build and analyze (push) Failing after 26s
This commit is contained in:
@@ -9,21 +9,13 @@ async function read(relativePath) {
|
||||
return fs.readFile(path.join(root, relativePath), 'utf8');
|
||||
}
|
||||
|
||||
async function readIfExists(relativePath) {
|
||||
try {
|
||||
return await read(relativePath);
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') return '';
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
test('route activation timestamp is available for editor draft handling', async () => {
|
||||
const schema = await readIfExists('database/schema.sql');
|
||||
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 schemaDefinesColumn = /\bactivated_at\s+DATETIME\s+NULL\b/i.test(schema);
|
||||
const migrationDefinesColumn = /ALTER\s+TABLE\s+routes\s+ADD\s+COLUMN\s+activated_at\s+DATETIME\s+NULL/i.test(migration);
|
||||
const routeTable = schema.match(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?routes\s*\([\s\S]*?\);/i);
|
||||
|
||||
assert.ok(schemaDefinesColumn || migrationDefinesColumn);
|
||||
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.match(migration, /Neue Strecken bleiben unveröffentlicht|unpublished|activated_at is NULL/i);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user