@@ -880,16 +880,6 @@ function migration09_addTimeseriesStats(db: Database.Database): void {
880880 created_at INTEGER NOT NULL
881881 )
882882 ` ) ;
883-
884- db . exec ( `
885- CREATE INDEX idx_timeseries_timestamp_resolution
886- ON timeseries_stats (timestamp, resolution)
887- ` ) ;
888-
889- db . exec ( `
890- CREATE INDEX idx_timeseries_resolution
891- ON timeseries_stats (resolution)
892- ` ) ;
893883 } ) ;
894884
895885 migrate ( ) ;
@@ -1024,26 +1014,7 @@ function migration11_deduplicateTimeseriesAndAddRegistry(
10241014 }
10251015
10261016 // -------------------------------------------------------------------------
1027- // Step 2: Replace non-unique index with unique index
1028- // -------------------------------------------------------------------------
1029- // Drop the old non-unique index (created by migration 9). SQLite does not
1030- // support ALTER INDEX, so we drop and recreate.
1031- db . exec (
1032- "DROP INDEX IF EXISTS idx_timeseries_timestamp_resolution" ,
1033- ) ;
1034-
1035- // The table is now duplicate-free, so this will succeed.
1036- db . exec ( `
1037- CREATE UNIQUE INDEX idx_timeseries_timestamp_resolution
1038- ON timeseries_stats (timestamp, resolution)
1039- ` ) ;
1040-
1041- logger . info (
1042- "Replaced non-unique index with UNIQUE index on timeseries_stats(timestamp, resolution)" ,
1043- ) ;
1044-
1045- // -------------------------------------------------------------------------
1046- // Step 3: Create rrd_import_registry table
1017+ // Step 2: Create rrd_import_registry table
10471018 // -------------------------------------------------------------------------
10481019 db . exec ( `
10491020 CREATE TABLE IF NOT EXISTS rrd_import_registry (
@@ -1142,8 +1113,8 @@ function migration12_dropResolutionPromoteTimestampPk(
11421113
11431114 // Free space for adsb.im users. Also anyone else.
11441115
1145- db . exec ( `DROP INDEX idx_timeseries_resolution;` ) ;
1146- db . exec ( `DROP INDEX idx_timeseries_timestamp_resolution;` ) ;
1116+ db . exec ( `DROP INDEX IF EXISTS idx_timeseries_resolution;` ) ;
1117+ db . exec ( `DROP INDEX IF EXISTS idx_timeseries_timestamp_resolution;` ) ;
11471118
11481119 // -----------------------------------------------------------------------
11491120 // Step 2: Create new table — timestamp is INTEGER PRIMARY KEY (rowid alias)
0 commit comments