@simonbackx/simple-database 1.23.0 → 1.23.1
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.
|
@@ -11,8 +11,14 @@ class Migration extends Model_1.Model {
|
|
|
11
11
|
// Columns
|
|
12
12
|
this.id = null;
|
|
13
13
|
}
|
|
14
|
+
static cleanFileName(file) {
|
|
15
|
+
// Replace .ts with .js, to avoid rerunning same file depending whether ts-node is used
|
|
16
|
+
file = file.replace(".ts", ".js");
|
|
17
|
+
return file;
|
|
18
|
+
}
|
|
14
19
|
// Methods
|
|
15
20
|
static async isExecuted(file) {
|
|
21
|
+
file = this.cleanFileName(file);
|
|
16
22
|
const [rows] = await Database_1.Database.select(`SELECT count(*) as c FROM ${this.table} WHERE \`file\` = ? LIMIT 1`, [
|
|
17
23
|
file
|
|
18
24
|
]);
|
|
@@ -26,6 +32,7 @@ class Migration extends Model_1.Model {
|
|
|
26
32
|
if (await this.isExecuted(file)) {
|
|
27
33
|
return;
|
|
28
34
|
}
|
|
35
|
+
file = this.cleanFileName(file);
|
|
29
36
|
const migration = new Migration();
|
|
30
37
|
migration.file = file;
|
|
31
38
|
migration.executedOn = new Date();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Migration.js","sourceRoot":"","sources":["../../../src/models/Migration.ts"],"names":[],"mappings":";;;;AAAA,kDAA+C;AAC/C,4CAAyC;AACzC,iDAA8C;AAE9C,MAAa,SAAU,SAAQ,aAAK;IAApC;;QAGI,UAAU;QAEV,OAAE,GAAkB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Migration.js","sourceRoot":"","sources":["../../../src/models/Migration.ts"],"names":[],"mappings":";;;;AAAA,kDAA+C;AAC/C,4CAAyC;AACzC,iDAA8C;AAE9C,MAAa,SAAU,SAAQ,aAAK;IAApC;;QAGI,UAAU;QAEV,OAAE,GAAkB,IAAI,CAAC;IAyC7B,CAAC;IAjCW,MAAM,CAAC,aAAa,CAAC,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6CACZ;AAXrB,8BA8CC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@simonbackx/simple-database",
|
|
3
3
|
"main": "./dist/index.js",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
|
-
"version": "1.23.
|
|
5
|
+
"version": "1.23.1",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "yarn build && jest",
|
|
8
8
|
"build": "rm -rf ./dist && tsc -p . --declaration && mkdir -p ./dist/src/migrations && cp -a ./src/migrations/*.sql ./dist/src/migrations",
|