refactor for clarity (no logic changes)
This commit is contained in:
@@ -107,16 +107,9 @@ class AbsurdSqlDatabaseService implements DatabaseService {
|
||||
const extractMigrationNames: (result: QueryExecResult[]) => Set<string> = (
|
||||
result,
|
||||
) => {
|
||||
const queryResult = result as QueryExecResult[];
|
||||
// Even with the "select name" query, the QueryExecResult may be [] (which doesn't make sense to me).
|
||||
if (queryResult.length > 0) {
|
||||
const singleResult = queryResult[0];
|
||||
const executedMigrations: Set<string> = new Set(
|
||||
singleResult.values.map((row) => row[0] as string),
|
||||
);
|
||||
return executedMigrations;
|
||||
}
|
||||
return new Set();
|
||||
const names = result?.[0]?.values.map((row) => row[0] as string) || [];
|
||||
return new Set(names);
|
||||
};
|
||||
|
||||
// Run migrations
|
||||
|
||||
Reference in New Issue
Block a user