diff --git a/core/data/src/commonMain/sqldelight/databases/20.db b/core/data/src/commonMain/sqldelight/databases/20.db new file mode 100644 index 000000000..212427ac7 Binary files /dev/null and b/core/data/src/commonMain/sqldelight/databases/20.db differ diff --git a/core/data/src/commonMain/sqldelight/migrations/19.sqm b/core/data/src/commonMain/sqldelight/migrations/19.sqm new file mode 100644 index 000000000..9a329cbe8 --- /dev/null +++ b/core/data/src/commonMain/sqldelight/migrations/19.sqm @@ -0,0 +1,55 @@ +import kotlin.Boolean; +import kotlinx.datetime.Instant; + +ALTER TABLE feed RENAME TO feed_old; + +DROP INDEX feed_link_index; +DROP INDEX feed_pinned_at; +DROP INDEX feed_pinned_position; + +CREATE TABLE IF NOT EXISTS feed( + id TEXT NOT NULL PRIMARY KEY, + name TEXT NOT NULL, + icon TEXT NOT NULL, + description TEXT NOT NULL, + link TEXT NOT NULL, + homepageLink TEXT NOT NULL, + createdAt INTEGER AS Instant NOT NULL, + pinnedAt INTEGER AS Instant, + lastCleanUpAt INTEGER AS Instant, + alwaysFetchSourceArticle INTEGER AS Boolean NOT NULL DEFAULT 0, + pinnedPosition REAL NOT NULL DEFAULT 0.0 +); + +CREATE INDEX feed_link_index ON feed(link); +CREATE INDEX feed_pinned_at ON feed(pinnedAt); +CREATE INDEX feed_pinned_position ON feed(pinnedPosition); + +INSERT INTO feed( + id, + name, + icon, + description, + link, + homepageLink, + createdAt, + pinnedAt, + lastCleanUpAt, + alwaysFetchSourceArticle, + pinnedPosition +) +SELECT + id, + name, + 'https://www.google.com/s2/favicons?domain=' || homepageLink || '&sz=180' AS icon, + description, + link, + homepageLink, + createdAt, + pinnedAt, + lastCleanUpAt, + alwaysFetchSourceArticle, + pinnedPosition +FROM feed_old; + +DROP TABLE feed_old;