| @@ -105,7 +105,8 @@ func migrateFeedTypeATProto(db *DB) error { |
| 105 | error_count INTEGER NOT NULL DEFAULT 0, | 105 | error_count INTEGER NOT NULL DEFAULT 0, |
| 106 | favicon_url TEXT | 106 | favicon_url TEXT |
| 107 | )`, | 107 | )`, |
| 108 | - `INSERT INTO articles.feeds_new SELECT * FROM articles.feeds`, | 108 | + `INSERT INTO articles.feeds_new (feed_url, title, site_url, description, feed_type, last_fetched_at, last_error, subscriber_count, consecutive_empty_fetches, error_count, favicon_url) |
| | 109 | + SELECT feed_url, title, site_url, description, feed_type, last_fetched_at, last_error, subscriber_count, consecutive_empty_fetches, error_count, favicon_url FROM articles.feeds`, |
| 109 | `DROP TABLE articles.feeds`, | 110 | `DROP TABLE articles.feeds`, |
| 110 | `ALTER TABLE articles.feeds_new RENAME TO feeds`, | 111 | `ALTER TABLE articles.feeds_new RENAME TO feeds`, |
| 111 | } { | 112 | } { |
| @@ -119,9 +120,10 @@ func migrateFeedTypeATProto(db *DB) error { |
| 119 | | 120 | |
| 120 | func migrateAddPersonTargetType(db *DB) error { | 121 | func migrateAddPersonTargetType(db *DB) error { |
| 121 | for _, m := range []struct { | 122 | for _, m := range []struct { |
| 122 | - table string | 123 | + table string |
| 123 | - create string | 124 | + create string |
| 124 | - index string | 125 | + columns string |
| | 126 | + index string |
| 125 | }{ | 127 | }{ |
| 126 | { | 128 | { |
| 127 | table: "dismissed_recommendations", | 129 | table: "dismissed_recommendations", |
| @@ -133,7 +135,8 @@ func migrateAddPersonTargetType(db *DB) error { |
| 133 | dismissed_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | 135 | dismissed_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, |
| 134 | PRIMARY KEY (user_did, target_type, target_id) | 136 | PRIMARY KEY (user_did, target_type, target_id) |
| 135 | )`, | 137 | )`, |
| 136 | - index: "idx_dismissed_user_type", | 138 | + columns: "user_did, target_type, target_id, reason, dismissed_at", |
| | 139 | + index: "idx_dismissed_user_type", |
| 137 | }, | 140 | }, |
| 138 | { | 141 | { |
| 139 | table: "recommendation_impressions", | 142 | table: "recommendation_impressions", |
| @@ -147,7 +150,8 @@ func migrateAddPersonTargetType(db *DB) error { |
| 147 | acted BOOLEAN NOT NULL DEFAULT 0, | 150 | acted BOOLEAN NOT NULL DEFAULT 0, |
| 148 | PRIMARY KEY (user_did, target_type, target_id) | 151 | PRIMARY KEY (user_did, target_type, target_id) |
| 149 | )`, | 152 | )`, |
| 150 | - index: "idx_impressions_user_unacted", | 153 | + columns: "user_did, target_type, target_id, first_shown_at, last_shown_at, shown_count, acted", |
| | 154 | + index: "idx_impressions_user_unacted", |
| 151 | }, | 155 | }, |
| 152 | } { | 156 | } { |
| 153 | var schema string | 157 | var schema string |
| @@ -160,7 +164,7 @@ func migrateAddPersonTargetType(db *DB) error { |
| 160 | | 164 | |
| 161 | for _, stmt := range []string{ | 165 | for _, stmt := range []string{ |
| 162 | m.create, | 166 | m.create, |
| 163 | - fmt.Sprintf("INSERT INTO %s_new SELECT * FROM %s", m.table, m.table), | 167 | + fmt.Sprintf("INSERT INTO %s_new (%s) SELECT %s FROM %s", m.table, m.columns, m.columns, m.table), |
| 164 | fmt.Sprintf("DROP TABLE %s", m.table), | 168 | fmt.Sprintf("DROP TABLE %s", m.table), |
| 165 | fmt.Sprintf("ALTER TABLE %s_new RENAME TO %s", m.table, m.table), | 169 | fmt.Sprintf("ALTER TABLE %s_new RENAME TO %s", m.table, m.table), |
| 166 | fmt.Sprintf("CREATE INDEX IF NOT EXISTS %s ON %s(user_did, target_type)", m.index, m.table), | 170 | fmt.Sprintf("CREATE INDEX IF NOT EXISTS %s ON %s(user_did, target_type)", m.index, m.table), |