mwalajs 1.1.4 → 1.1.6

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.
@@ -0,0 +1,5 @@
1
+ DB_TYPE=mysql
2
+ DB_NAME=aatest
3
+ DB_HOST=localhost
4
+ DB_USER=root
5
+ DB_PASSWORD=
@@ -0,0 +1,5 @@
1
+ DB_TYPE=mysql
2
+ DB_NAME=mwalajs
3
+ DB_HOST=localhost
4
+ DB_USER=
5
+ DB_PASSWORD=
@@ -0,0 +1,19 @@
1
+ import { sequelize } from '../config/createTablesetdb.mjs';
2
+ import { DataTypes } from 'sequelize';
3
+
4
+ export const up = async () => {
5
+ await sequelize.getQueryInterface().createTable('users', {
6
+ id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false },
7
+ name: { type: DataTypes.STRING, allowNull: false },
8
+ email: { type: DataTypes.STRING, allowNull: false, unique: true },
9
+ password: { type: DataTypes.STRING, allowNull: false },
10
+ age: { type: DataTypes.INTEGER, allowNull: true },
11
+ address: { type: DataTypes.STRING, allowNull: true },
12
+ createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: new Date() },
13
+ updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: new Date() }
14
+ });
15
+ };
16
+
17
+ export const down = async () => {
18
+ await sequelize.getQueryInterface().dropTable('users');
19
+ };
@@ -0,0 +1,19 @@
1
+ import { sequelize } from '../config/createTablesetdb.mjs';
2
+ import { DataTypes } from 'sequelize';
3
+
4
+ export const up = async () => {
5
+ await sequelize.getQueryInterface().createTable('logs', {
6
+ id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, allowNull: false },
7
+ name: { type: DataTypes.STRING, allowNull: false },
8
+ email: { type: DataTypes.STRING, allowNull: false, unique: true },
9
+ password: { type: DataTypes.STRING, allowNull: false },
10
+ age: { type: DataTypes.INTEGER, allowNull: true },
11
+ address: { type: DataTypes.STRING, allowNull: true },
12
+ createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: new Date() },
13
+ updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: new Date() }
14
+ });
15
+ };
16
+
17
+ export const down = async () => {
18
+ await sequelize.getQueryInterface().dropTable('logs');
19
+ };
@@ -1 +1 @@
1
- ["20250308115724_create_users.mjs","20250724111240_create_transactions.mjs"]
1
+ ["20250308115724_create_users.mjs","20250724111240_create_transactions.mjs","20260321052103_create_users.mjs","20260321052120_create_logs.mjs"]
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "mwalajs",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "MwalaJS Framework CLI Tool and Web Framework for Backend and Frontend Development.",
5
5
  "type": "module",
6
6
  "main": "app.mjs",
7
7
  "exports": {
8
- ".": {
9
- "import": "./index.mjs"
10
- }
8
+ ".": "./index.mjs",
9
+ "./config/*": "./config/*.mjs",
10
+ "./migrations/*": "./migrations/*.mjs",
11
+ "./bin/*": "./bin/*.mjs"
11
12
  },
12
13
  "bin": {
13
14
  "mwala": "bin/mwala.mjs"
@@ -29,7 +30,7 @@
29
30
  "mongoose": "^8.12.1",
30
31
  "mpath": "^0.9.0",
31
32
  "multer": "^1.4.2",
32
- "mwalajs": "^1.0.8",
33
+ "mwalajs": "^1.1.5",
33
34
  "mysql2": "^3.13.0",
34
35
  "pg": "^8.13.3",
35
36
  "pg-hstore": "^2.3.4",
package/runMigrations.mjs CHANGED
@@ -1,7 +1,16 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import readline from 'readline';
4
- import { sequelize } from './config/createTablesetdb.mjs';
4
+ // import { sequelize } from './config/createTablesetdb.mjs';
5
+
6
+
7
+ // const { sequelize } = await import(
8
+ // new URL('../config/createTablesetdb.mjs', import.meta.url)
9
+ // );
10
+ const sequelize = (await import(
11
+ new URL('./config/createTablesetdb.mjs', import.meta.url)
12
+ )).sequelize;
13
+
5
14
  import { DataTypes } from 'sequelize';
6
15
 
7
16
  // Define directory for migrations
@@ -37,7 +46,10 @@ export const createTable = async (tableName) => {
37
46
  const migrationFile = path.join(migrationsDir, `${timestamp}_create_${tableName}.mjs`);
38
47
 
39
48
  const migrationTemplate = `
40
- import { sequelize } from '../config/createTablesetdb.mjs';
49
+
50
+ const sequelize = (await import(
51
+ new URL('./config/createTablesetdb.mjs', import.meta.url)
52
+ )).sequelize;
41
53
  import { DataTypes } from 'sequelize';
42
54
 
43
55
  export const up = async () => {