-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
91 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import fs from 'fs/promises' | ||
import { getDb } from './db' | ||
|
||
const run = async () => { | ||
const db = getDb() | ||
const didsFile = await fs.readFile('dids.txt') | ||
const dids = didsFile | ||
.toString() | ||
.split('\n') | ||
.map((did) => ({ | ||
did: did.trim(), | ||
phase: 0, | ||
failed: 0 as const, | ||
})) | ||
await db | ||
.insertInto('status') | ||
.values(dids) | ||
.onConflict((oc) => oc.doNothing()) | ||
.execute() | ||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Migrator } from 'kysely' | ||
import { dbMigrationProvider, getDb } from './db' | ||
|
||
const run = async () => { | ||
const db = getDb() | ||
|
||
const migrator = new Migrator({ db, provider: dbMigrationProvider }) | ||
const { error } = await migrator.migrateToLatest() | ||
if (error) throw error | ||
return db | ||
} | ||
|
||
run() |