@storecraft/database-sql-base 1.0.16 → 1.0.17
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.
package/migrate.js
CHANGED
@@ -37,8 +37,9 @@ export const get_migrations = async (dialect_type='SQLITE') => {
|
|
37
37
|
|
38
38
|
for (const file of files) {
|
39
39
|
if(file.endsWith('.js')) {
|
40
|
+
const file_name = file.split('.').slice(0, -1).join('.');
|
40
41
|
const migration = await import(path.join(__dirname, folder, file));
|
41
|
-
migrations[
|
42
|
+
migrations[file_name] = migration;
|
42
43
|
}
|
43
44
|
}
|
44
45
|
|
@@ -9,18 +9,15 @@ import { Kysely } from 'kysely'
|
|
9
9
|
*/
|
10
10
|
export async function up(db) {
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
.execute();
|
22
|
-
} catch (e) {
|
23
|
-
}
|
12
|
+
await db.schema
|
13
|
+
.alterTable('auth_users')
|
14
|
+
.addColumn('firstname', 'text')
|
15
|
+
.execute();
|
16
|
+
|
17
|
+
await db.schema
|
18
|
+
.alterTable('auth_users')
|
19
|
+
.addColumn('lastname', 'text')
|
20
|
+
.execute();
|
24
21
|
}
|
25
22
|
|
26
23
|
/**
|
@@ -28,16 +25,13 @@ export async function up(db) {
|
|
28
25
|
* @param {Kysely<Database>} db
|
29
26
|
*/
|
30
27
|
export async function down(db) {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
.execute();
|
41
|
-
} catch (e) {
|
42
|
-
}
|
28
|
+
await db.schema
|
29
|
+
.alterTable('auth_users')
|
30
|
+
.dropColumn('firstname')
|
31
|
+
.execute();
|
32
|
+
|
33
|
+
await db.schema
|
34
|
+
.alterTable('auth_users')
|
35
|
+
.dropColumn('lastname')
|
36
|
+
.execute();
|
43
37
|
}
|