forked from trent_larson/crowd-funder-for-time-pwa
fix: Improve database migration handling and error recovery
- Enhanced migration service error handling and logging - Added better recovery mechanisms for failed migrations - Improved database state validation before migration execution - Added comprehensive error reporting in migration service - Updated HomeView to handle migration errors gracefully - Fixed database initialization sequence to prevent constraint violations This addresses UNIQUE constraint failed errors during app startup and provides better user feedback during database migration issues.
This commit is contained in:
@@ -121,15 +121,17 @@ export async function runMigrations<T>(
|
||||
} catch (error) {
|
||||
// Handle specific cases where the migration might be partially applied
|
||||
const errorMessage = String(error).toLowerCase();
|
||||
|
||||
|
||||
// Check if it's a duplicate column error - this means the column already exists
|
||||
if (errorMessage.includes('duplicate column') ||
|
||||
errorMessage.includes('column already exists') ||
|
||||
errorMessage.includes('already exists')) {
|
||||
if (
|
||||
errorMessage.includes("duplicate column") ||
|
||||
errorMessage.includes("column already exists") ||
|
||||
errorMessage.includes("already exists")
|
||||
) {
|
||||
logger.warn(
|
||||
`[MigrationService] Migration ${migration.name} appears to be already applied (${errorMessage}). Marking as complete.`,
|
||||
);
|
||||
|
||||
|
||||
// Mark the migration as applied since the schema change already exists
|
||||
try {
|
||||
await sqlExec("INSERT INTO migrations (name) VALUES (?)", [
|
||||
|
||||
@@ -255,7 +255,6 @@ Raymer * @version 1.0.0 */
|
||||
<button class="text-blue-500">View All New Activity For You</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>{{ apiServer }}</div>
|
||||
<InfiniteScroll @reached-bottom="loadMoreGives">
|
||||
<ul id="listLatestActivity" class="space-y-4">
|
||||
<ActivityListItem
|
||||
|
||||
Reference in New Issue
Block a user