-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: added WithTypeOrmQuery type to core module and renamed enableUui…
…dv4 to enablePostgresUuidExtension
- Loading branch information
Showing
10 changed files
with
40 additions
and
21 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { DataStoreMigrations } from './generic' | ||
export { enableUuidv4 } from './postgres/uuid' | ||
export { createQueryRunnerAdapter } from './postgres/utils' |
5 changes: 3 additions & 2 deletions
5
packages/data-store/src/migrations/postgres/1659463079428-CreateContacts.ts
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
5 changes: 3 additions & 2 deletions
5
packages/data-store/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts
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
5 changes: 3 additions & 2 deletions
5
packages/data-store/src/migrations/postgres/1690925872592-CreateContacts.ts
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,8 @@ | ||
import { QueryRunner } from 'typeorm' | ||
import { WithTypeOrmQuery } from '@sphereon/ssi-sdk.core' | ||
|
||
export function createQueryRunnerAdapter(queryRunner: QueryRunner): WithTypeOrmQuery { | ||
return (query: string, parameters?: any[]) => { | ||
return queryRunner.query(query, parameters); | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
export const flattenArray = <T>(args: { items: Array<T | Array<T>> }): Array<T> => args.items.flat() as Array<T> | ||
|
||
export const flattenMigrations = <T>(args: { migrations: Array<T | Array<T>> }): Array<T> => args.migrations.flat() as Array<T> | ||
|
||
export type WithTypeOrmQuery = | ||
((query: string, parameters?: any[]) => Promise<any>) | | ||
((query: string, parameters?: any[], useStructuredResult?: boolean) => Promise<any>) | ||
|
||
|
||
export const enablePostgresUuidExtension = async (query: WithTypeOrmQuery) => { | ||
try { | ||
await query(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`); | ||
} catch (error) { | ||
console.log( | ||
`Please enable the uuid-ossp.control extension in your PostgreSQL installation. It enables generating V4 UUID and can be found in the postgresql-contrib package` | ||
); | ||
throw error; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.