lamix 4.2.7 → 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 +7 -14
- package/artisan.d.ts +2 -0
- package/artisan.js +10 -11
- package/examples/User.md +4 -2
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Migration & Seeder CLI Tool
|
|
2
2
|
This package supports MySQL (mysql2), PostgreSQL (pg), and SQLite (sqlite3).
|
|
3
|
-
A simple Node.js CLI for generating and running database migrations and seeders with MySQL, using a custom DB wrapper.
|
|
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
6
|
get all Usage in examples provided for any issue or support get in tourch @ `andrewkhabweri@gmail.com`
|
|
@@ -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
|
|
|
@@ -82,12 +82,12 @@ Migrations table Supports chainable modifiers filled Manually :
|
|
|
82
82
|
## Setup
|
|
83
83
|
|
|
84
84
|
1. download this project.
|
|
85
|
-
npm i
|
|
85
|
+
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`, `DB_USER`, `DB_PASS`, `DB_NAME`, `DB_PORT`, `DB_CONNECTION_LIMIT`.
|
|
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,10 +12,11 @@ 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() {
|
|
19
|
+
const Profile = require('./Profile');
|
|
19
20
|
return this.hasOne(Profile).onDelete('restrict');
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -33,7 +34,8 @@ class User extends BaseModel {
|
|
|
33
34
|
|
|
34
35
|
// One-to-many: User -> Post
|
|
35
36
|
posts() {
|
|
36
|
-
|
|
37
|
+
const Post = require('./Post');
|
|
38
|
+
return this.hasMany(Post', 'user_id', 'id').onDelete('cascade');
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
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
|
-
"
|
|
27
|
-
"build": "tsc && echo 'Build complete'"
|
|
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": {
|
|
@@ -42,7 +45,6 @@
|
|
|
42
45
|
"database",
|
|
43
46
|
"laravel-inspired"
|
|
44
47
|
],
|
|
45
|
-
|
|
46
48
|
"author": {
|
|
47
49
|
"name": "Andrew Khabweri",
|
|
48
50
|
"email": "andrewkhabweri@gmail.com"
|