@mtg-tracker/common 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import mysql from 'mysql2/promise';
|
|
2
|
-
export declare function runMigrations(pool: mysql.Pool, service: string): Promise<void>;
|
|
2
|
+
export declare function runMigrations(pool: mysql.Pool, migrationsDir: string, service: string): Promise<void>;
|
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.runMigrations = runMigrations;
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
|
-
function runMigrations(pool, service) {
|
|
18
|
+
function runMigrations(pool, migrationsDir, service) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
console.log(`Running database migrations for the ${service} service...`);
|
|
21
21
|
// Sanitize service name
|
|
@@ -29,8 +29,7 @@ function runMigrations(pool, service) {
|
|
|
29
29
|
executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
30
30
|
)
|
|
31
31
|
`);
|
|
32
|
-
// Get all migration files
|
|
33
|
-
const migrationsDir = path_1.default.join(__dirname, 'migrations');
|
|
32
|
+
// Get all migration files from the provided directory
|
|
34
33
|
const files = fs_1.default.readdirSync(migrationsDir)
|
|
35
34
|
.filter(file => file.endsWith('_up.sql'))
|
|
36
35
|
.sort(); // Sort to ensure correct order
|