forked from jsnbuchanan/crowd-funder-for-time-pwa
fix: resolve migration service import and function signature conflicts
- Fix import in src/db-sql/migration.ts to use named imports and alias runMigrations to avoid naming conflict - Add missing migration management functions (registerMigration, runMigrations) to migrationService with full typing and logging - Update function signatures to accept SQL parameters for compatibility with AbsurdSqlDatabaseService - Clean up Prettier formatting issues in migrationService and migration.ts - Confirmed dev server and linter run cleanly Co-authored-by: Matthew Raymer
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import migrationService from "../services/migrationService";
|
||||
import {
|
||||
registerMigration,
|
||||
runMigrations as runMigrationsService,
|
||||
} from "../services/migrationService";
|
||||
import { DEFAULT_ENDORSER_API_SERVER } from "@/constants/app";
|
||||
import { arrayBufferToBase64 } from "@/libs/crypto";
|
||||
|
||||
@@ -123,16 +126,12 @@ const MIGRATIONS = [
|
||||
* @param extractMigrationNames - A function that extracts the names (string array) from "select name from migrations"
|
||||
*/
|
||||
export async function runMigrations<T>(
|
||||
sqlExec: (sql: string) => Promise<unknown>,
|
||||
sqlQuery: (sql: string) => Promise<T>,
|
||||
sqlExec: (sql: string, params?: unknown[]) => Promise<unknown>,
|
||||
sqlQuery: (sql: string, params?: unknown[]) => Promise<T>,
|
||||
extractMigrationNames: (result: T) => Set<string>,
|
||||
): Promise<void> {
|
||||
for (const migration of MIGRATIONS) {
|
||||
migrationService.registerMigration(migration);
|
||||
registerMigration(migration);
|
||||
}
|
||||
await migrationService.runMigrations(
|
||||
sqlExec,
|
||||
sqlQuery,
|
||||
extractMigrationNames,
|
||||
);
|
||||
await runMigrationsService(sqlExec, sqlQuery, extractMigrationNames);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user