@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[file] = migration;
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
- try {
13
- await db.schema
14
- .alterTable('auth_users')
15
- .addColumn('firstname', 'text')
16
- .execute();
17
-
18
- await db.schema
19
- .alterTable('auth_users')
20
- .addColumn('lastname', 'text')
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
- try {
32
- await db.schema
33
- .alterTable('auth_users')
34
- .dropColumn('firstname')
35
- .execute();
36
-
37
- await db.schema
38
- .alterTable('auth_users')
39
- .dropColumn('lastname')
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storecraft/database-sql-base",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Official SQL Database driver for storecraft",
5
5
  "license": "MIT",
6
6
  "author": "Tomer Shalev (https://github.com/store-craft)",