Skip to content

Commit 40eefbd

Browse files
author
VuXfi
committed
feat(migrations): add migration management structure and types
1 parent 6ea9899 commit 40eefbd

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ export * from "./models/MediaManagerAP"
2424
export * from "./models/MediaManagerAssociationsAP"
2525
export * from "./models/MediaManagerMetaAP"
2626
export * from "./models/NavigationAP"
27+
export * from "./migrations"

src/interfaces/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,10 @@ export interface INotificationEvent {
6969
notificationClass?: string;
7070
channel?: string
7171
userId?: number;
72-
}
72+
}
73+
74+
export type Migration = {
75+
name: string;
76+
up: (args: { context: any }) => Promise<unknown> | unknown;
77+
down: (args: { context: any }) => Promise<unknown> | unknown;
78+
};

src/migrations/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { migrationsUmzug as umzug } from "./umzug";
2+
3+
export const migrations = {
4+
umzug
5+
}

src/migrations/umzug.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Migration } from "interfaces/types"
2+
import {up as up0001, down as down0001 } from "./umzug/0001"
3+
export const migrationsUmzug: Migration[] = [
4+
{
5+
name: "0001",
6+
up: up0001,
7+
down: down0001
8+
}
9+
]

0 commit comments

Comments
 (0)