-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #903 from hydralauncher/feat/remove-synchronize-ty…
…peorm feat: use knex migrations
- Loading branch information
Showing
17 changed files
with
406 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
dist | ||
out | ||
.gitignore | ||
migration.stub |
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 |
---|---|---|
|
@@ -5,4 +5,3 @@ pnpm-lock.yaml | |
LICENSE.md | ||
tsconfig.json | ||
tsconfig.*.json | ||
src/main/migrations |
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
Binary file not shown.
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,29 @@ | ||
import knex, { Knex } from "knex"; | ||
import { databasePath } from "./constants"; | ||
import { Hydra2_0_3 } from "./migrations/20240830143811_Hydra_2_0_3"; | ||
import { RepackUris } from "./migrations/20240830143906_RepackUris"; | ||
|
||
export type HydraMigration = Knex.Migration & { name: string }; | ||
|
||
class MigrationSource implements Knex.MigrationSource<HydraMigration> { | ||
getMigrations(): Promise<HydraMigration[]> { | ||
return Promise.resolve([Hydra2_0_3, RepackUris]); | ||
} | ||
getMigrationName(migration: HydraMigration): string { | ||
return migration.name; | ||
} | ||
getMigration(migration: HydraMigration): Promise<Knex.Migration> { | ||
return Promise.resolve(migration); | ||
} | ||
} | ||
|
||
export const knexClient = knex({ | ||
client: "better-sqlite3", | ||
connection: { | ||
filename: databasePath, | ||
}, | ||
}); | ||
|
||
export const migrationConfig: Knex.MigratorConfig = { | ||
migrationSource: new MigrationSource(), | ||
}; |
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,10 @@ | ||
const config = { | ||
development: { | ||
migrations: { | ||
extension: "ts", | ||
stub: "migrations/migration.stub", | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.