forked from bcc-code/directus-schema-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add functions for forcing auto increment on postgres
- Loading branch information
Showing
4 changed files
with
163 additions
and
1 deletion.
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
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,30 @@ | ||
import { postgresSequenceToSerialType } from './utils'; | ||
|
||
const modifiers: modifiersType = { | ||
import: { | ||
}, | ||
export: { | ||
postgres: [postgresSequenceToSerialType] | ||
} | ||
} | ||
|
||
export function importHook(snapshot: any) { | ||
if (modifiers.import[snapshot.vendor]?.length) | ||
return modifiers.import[snapshot.vendor]?.reduce((_snapshot, modifier) => { | ||
return modifier(_snapshot); | ||
}, snapshot) | ||
return snapshot; | ||
}; | ||
|
||
export function exportHook(snapshot: any) { | ||
if (modifiers.export[snapshot.vendor]?.length) | ||
return modifiers.export[snapshot.vendor]!.reduce((_snapshot, modifier) => { | ||
return modifier(_snapshot); | ||
}, snapshot) | ||
return snapshot; | ||
}; | ||
|
||
type modifiersType = { | ||
import: Record<string, any[]> | ||
export: Record<string, any[]> | ||
} |