lamix 4.2.8 → 4.2.9
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/README.md +6 -13
- package/artisan.d.ts +2 -0
- package/artisan.js +10 -11
- package/examples/User.md +3 -3
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ This package supports MySQL (mysql2), PostgreSQL (pg), and SQLite (sqlite3).
|
|
|
3
3
|
A simple Node.js CLI for generating Models and running database migrations and seeders with MySQL, using a custom DB wrapper.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
|
-
get all Usage in examples
|
|
6
|
+
get all Usage in examples provided for any issue or support get in tourch @ `andrewkhabweri@gmail.com`
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
9
|
- Generate migration files dynamically with fields
|
|
@@ -51,7 +51,7 @@ image
|
|
|
51
51
|
file
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
Migrations table Supports chainable modifiers filled Manually :
|
|
54
|
+
Migrations table Supports chainable modifiers filled can be added Manually :
|
|
55
55
|
|
|
56
56
|
.notNullable()
|
|
57
57
|
|
|
@@ -86,8 +86,8 @@ npm i lamix
|
|
|
86
86
|
|
|
87
87
|
2. Install dependencies (if any).
|
|
88
88
|
> This tool uses `mysql2`,`pg`,`sqlite3` driver, so make sure you install your prefered driver:
|
|
89
|
-
|
|
90
|
-
Configure DB via environment variables: `'DB_CONNECTION=mysql',DB_HOST=
|
|
89
|
+
DATABASE CONNECTION IN `.env`FILE
|
|
90
|
+
Configure DB via environment variables: `'DB_CONNECTION=mysql',DB_HOST=your db hast`, `DB_USER=your db user`, `DB_PASS=your db password`, `DB_NAME=your db name`, `DB_PORT=your db port`, `DB_CONNECTION_LIMIT=100`.
|
|
91
91
|
|
|
92
92
|
## Quick start
|
|
93
93
|
for database connection use any driver of your choice eg
|
|
@@ -104,15 +104,8 @@ for database connection use any driver of your choice eg
|
|
|
104
104
|
```bash
|
|
105
105
|
npm i lamix
|
|
106
106
|
|
|
107
|
-
npm install mysql2
|
|
107
|
+
npm install mysql2 # or pg or sqlite3
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
#Make Sure you put this in package.json inside your project directory for
|
|
111
|
-
#CLI generating Commands to work
|
|
112
|
-
|
|
113
|
-
"scripts": {
|
|
114
|
-
"artisan": "node ./node_modules/lamix/artisan.js"
|
|
115
|
-
}
|
|
116
|
-
|
|
117
110
|
# TO See All the Available CLI Commands Run in Terminal
|
|
118
|
-
|
|
111
|
+
npx lamix
|
package/artisan.d.ts
ADDED
package/artisan.js
CHANGED
|
@@ -592,22 +592,21 @@ module.exports = ${className};
|
|
|
592
592
|
📦 CLI Migration & Seeder Tool
|
|
593
593
|
|
|
594
594
|
Usage:
|
|
595
|
-
|
|
595
|
+
npx lamix
|
|
596
596
|
🔹 Migration Commands:
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
597
|
+
make:migration <TableName> [column:type ...]
|
|
598
|
+
migrate
|
|
599
|
+
migrate:rollback
|
|
600
600
|
|
|
601
601
|
🔹 Seeder Commands:
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
602
|
+
make:seeder <name>
|
|
603
|
+
db:seed
|
|
604
|
+
db:seed:refresh
|
|
605
|
+
db:seed:only <file>
|
|
606
606
|
|
|
607
607
|
🔹 Model Generator:
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
npm run artisan -- make:model <name> name:string price:decimal stock:integer
|
|
608
|
+
make:model <Name>
|
|
609
|
+
make:model <Name> field:type field:type
|
|
611
610
|
`);
|
|
612
611
|
}
|
|
613
612
|
})();
|
package/examples/User.md
CHANGED
|
@@ -12,7 +12,7 @@ class User extends BaseModel {
|
|
|
12
12
|
email: 'required|email|unique:users,email',
|
|
13
13
|
password: 'required|string|min:6',
|
|
14
14
|
phone: 'nullable|phone',
|
|
15
|
-
status: '
|
|
15
|
+
status: 'boolean'
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
profile() {
|
|
@@ -34,8 +34,8 @@ class User extends BaseModel {
|
|
|
34
34
|
|
|
35
35
|
// One-to-many: User -> Post
|
|
36
36
|
posts() {
|
|
37
|
-
Post = require('./Post');
|
|
38
|
-
return this.hasMany(Post, 'user_id', 'id').onDelete('cascade');
|
|
37
|
+
const Post = require('./Post');
|
|
38
|
+
return this.hasMany(Post', 'user_id', 'id').onDelete('cascade');
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lamix",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.9",
|
|
4
4
|
"description": "lamix - ORM for Node-express js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"index.js",
|
|
16
16
|
"index.d.ts",
|
|
17
17
|
"artisan.js",
|
|
18
|
+
"artisan.d.ts",
|
|
18
19
|
"README.md",
|
|
19
20
|
"examples"
|
|
20
21
|
],
|
|
@@ -22,12 +23,14 @@
|
|
|
22
23
|
"type": "git",
|
|
23
24
|
"url": "https://github.com/andrewkhabweri-spec/lamix.git"
|
|
24
25
|
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"lamix": "./artisan.js"
|
|
28
|
+
},
|
|
25
29
|
"scripts": {
|
|
26
|
-
"artisan": "node artisan.js",
|
|
27
30
|
"build": "tsc && echo 'Build complete'"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
30
|
-
"@types/node": "^
|
|
33
|
+
"@types/node": "^25.0.3",
|
|
31
34
|
"typescript": "^5.9.3"
|
|
32
35
|
},
|
|
33
36
|
"dependencies": {
|