Browse Source

fix: Resolve database migration conflicts with INSERT OR IGNORE

- Updated migration 001_initial to use INSERT OR IGNORE for secret and settings tables
- Prevents unique constraint failures when database already exists from previous runs
- Allows clean migration process without requiring database deletion
- Database initialization now works properly in development environment

Fixes:
- UNIQUE constraint failed: secret.id error resolved
- Migration process now handles existing data gracefully
- Fresh database creation works without conflicts
- Electron app now starts successfully with working database

All major Electron issues resolved:
 TypeScript compilation working
 SQLite plugin properly configured
 UI assets loading correctly
 Database migrations successful
 App startup and initialization working
streamline-attempt
Matthew Raymer 1 week ago
parent
commit
1d27ba8403
  1. 4
      src/db-sql/migration.ts

4
src/db-sql/migration.ts

@ -53,7 +53,7 @@ const MIGRATIONS = [
secretBase64 TEXT NOT NULL
);
INSERT INTO secret (id, secretBase64) VALUES (1, '${secretBase64}');
INSERT OR IGNORE INTO secret (id, secretBase64) VALUES (1, '${secretBase64}');
CREATE TABLE IF NOT EXISTS settings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@ -89,7 +89,7 @@ const MIGRATIONS = [
CREATE INDEX IF NOT EXISTS idx_settings_accountDid ON settings(accountDid);
INSERT INTO settings (id, apiServer) VALUES (1, '${DEFAULT_ENDORSER_API_SERVER}');
INSERT OR IGNORE INTO settings (id, apiServer) VALUES (1, '${DEFAULT_ENDORSER_API_SERVER}');
CREATE TABLE IF NOT EXISTS contacts (
id INTEGER PRIMARY KEY AUTOINCREMENT,

Loading…
Cancel
Save