Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
leafac committed May 7, 2024
1 parent c3491ba commit bbcbb42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 2.0.0 · 2024-05-07

- Adapted Kill the Newsletter! to use [Radically Straightforward](https://github.com/radically-straightforward/radically-straightforward).
12 changes: 6 additions & 6 deletions source/migrate--v1.0.1--v2.0.0.mts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ await new Database(process.argv[3]).migrate((newDatabase) => {
) STRICT;
CREATE INDEX "entriesReference" ON "entries" ("reference");
CREATE INDEX "entriesFeed" ON "entries" ("feed");
`
`,
);
let feedsCount = oldDatabase.get<{ count: number }>(
sql`
SELECT COUNT(*) AS "count" FROM "feeds"
`
`,
)!.count;
utilities.log(String(feedsCount));
for (const feed of oldDatabase.iterate<{
Expand All @@ -36,14 +36,14 @@ await new Database(process.argv[3]).migrate((newDatabase) => {
}>(
sql`
SELECT "id", "reference", "title" FROM "feeds" ORDER BY "id" ASC
`
`,
)) {
if (feedsCount % 1000 === 0) utilities.log(String(feedsCount));
feedsCount--;
const newFeedId = newDatabase.run(
sql`
INSERT INTO "feeds" ("reference", "title") VALUES (${feed.reference}, ${feed.title})
`
`,
).lastInsertRowid;
for (const entry of oldDatabase.iterate<{
reference: string;
Expand All @@ -56,7 +56,7 @@ await new Database(process.argv[3]).migrate((newDatabase) => {
FROM "entries"
WHERE "feed" = ${feed.id}
ORDER BY "id" ASC
`
`,
))
newDatabase.run(
sql`
Expand All @@ -68,7 +68,7 @@ await new Database(process.argv[3]).migrate((newDatabase) => {
${entry.title},
${entry.content}
)
`
`,
);
}
});
Expand Down

0 comments on commit bbcbb42

Please sign in to comment.