MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / runMigration

Function runMigration

packages/db/code-migrations/migrate.ts:91–116  ·  view source on GitHub ↗
(migrationsDir: string, file: string)

Source from the content-addressed store, hash-verified

89}
90
91async function runMigration(migrationsDir: string, file: string) {
92 printBoxMessage('⚡️ Running Migration ⚡️ ', [`${file}`]);
93 try {
94 const migration = await import(path.join(migrationsDir, file));
95 await migration.up();
96 if (!getIsDry() && !getShouldIgnoreRecord()) {
97 await db.codeMigration.upsert({
98 where: {
99 name: file,
100 },
101 update: {
102 name: file,
103 },
104 create: {
105 name: file,
106 },
107 });
108 }
109 } catch (error) {
110 printBoxMessage('❌ Migration Failed ❌', [
111 `Error running migration ${file}:`,
112 error,
113 ]);
114 process.exit(1);
115 }
116}
117
118migrate();

Callers 1

migrateFunction · 0.85

Calls 4

printBoxMessageFunction · 0.90
getIsDryFunction · 0.90
getShouldIgnoreRecordFunction · 0.90
joinMethod · 0.80

Tested by

no test coverage detected