lamix 4.2.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.
- package/LICENSE +5 -0
- package/README.md +118 -0
- package/artisan.js +613 -0
- package/examples/Alternative.md +23 -0
- package/examples/CRUD.md +51 -0
- package/examples/Post.md +28 -0
- package/examples/PostController.md +93 -0
- package/examples/Query Builder.md +55 -0
- package/examples/Relations.md +16 -0
- package/examples/Role.md +26 -0
- package/examples/RoleController.md +65 -0
- package/examples/Usages.md +132 -0
- package/examples/User.md +40 -0
- package/examples/UserController.md +98 -0
- package/index.d.ts +580 -0
- package/index.js +3718 -0
- package/package.json +63 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Migration & Seeder CLI Tool
|
|
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.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
get all Usage in examples provided for any issue or support get in tourch @ `andrewkhabweri@gmail.com`
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Generate migration files dynamically with fields
|
|
10
|
+
- Run migrations
|
|
11
|
+
- Rollback last migration
|
|
12
|
+
- Generate seed files dynamically
|
|
13
|
+
- Run all unapplied seeders
|
|
14
|
+
- Refresh all seeds (rollback + rerun)
|
|
15
|
+
- Run specific seed files
|
|
16
|
+
- Built-in schema builder
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
For rules Validation below are the Avalable data validation rules used in Model:
|
|
20
|
+
---
|
|
21
|
+
required
|
|
22
|
+
string
|
|
23
|
+
boolean
|
|
24
|
+
numeric
|
|
25
|
+
email
|
|
26
|
+
min
|
|
27
|
+
max
|
|
28
|
+
confirmed
|
|
29
|
+
date
|
|
30
|
+
url
|
|
31
|
+
regex
|
|
32
|
+
in
|
|
33
|
+
unique
|
|
34
|
+
exists
|
|
35
|
+
phone
|
|
36
|
+
alpha
|
|
37
|
+
alpha_num
|
|
38
|
+
array
|
|
39
|
+
json
|
|
40
|
+
between
|
|
41
|
+
not_in
|
|
42
|
+
integer
|
|
43
|
+
ip
|
|
44
|
+
uuid
|
|
45
|
+
slug
|
|
46
|
+
after
|
|
47
|
+
before
|
|
48
|
+
size
|
|
49
|
+
mimes
|
|
50
|
+
image
|
|
51
|
+
file
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Migrations table Supports chainable modifiers filled Manually :
|
|
55
|
+
|
|
56
|
+
.notNullable()
|
|
57
|
+
|
|
58
|
+
.nullable()
|
|
59
|
+
|
|
60
|
+
.defaultTo(value)
|
|
61
|
+
|
|
62
|
+
.unsigned() (MySQL only)
|
|
63
|
+
|
|
64
|
+
.unique()
|
|
65
|
+
|
|
66
|
+
.primary()
|
|
67
|
+
|
|
68
|
+
.autoIncrement()
|
|
69
|
+
|
|
70
|
+
.comment('text') (MySQL only)
|
|
71
|
+
|
|
72
|
+
.after('columnName') (MySQL only)
|
|
73
|
+
|
|
74
|
+
## Prerequisites
|
|
75
|
+
|
|
76
|
+
- Node.js (v18+ recommended)
|
|
77
|
+
- MySQL database
|
|
78
|
+
- `.env` file configured with your database credentials (see example below)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Setup
|
|
83
|
+
|
|
84
|
+
1. download this project.
|
|
85
|
+
npm i nexium-orm
|
|
86
|
+
|
|
87
|
+
2. Install dependencies (if any).
|
|
88
|
+
> This tool uses `mysql2`,`pg`,`sqlite3` driver, so make sure you install your prefered driver:
|
|
89
|
+
EITHER
|
|
90
|
+
Configure DB via environment variables: `'DB_CONNECTION=mysql',DB_HOST`, `DB_USER`, `DB_PASS`, `DB_NAME`, `DB_PORT`, `DB_CONNECTION_LIMIT`.
|
|
91
|
+
|
|
92
|
+
## Quick start
|
|
93
|
+
for database connection use any driver of your choice eg
|
|
94
|
+
`DB_CONNECTION=mysql` # if using mysql2
|
|
95
|
+
`DB_CONNECTION=pg` # if using PostgreSQL
|
|
96
|
+
`DB_CONNECTION=sqlite` # for sqlite
|
|
97
|
+
|
|
98
|
+
`DB_DATABASE=./database.sqlite` # if using sqlite
|
|
99
|
+
|
|
100
|
+
1. Install dependencies:
|
|
101
|
+
```
|
|
102
|
+
npm install
|
|
103
|
+
```
|
|
104
|
+
```bash
|
|
105
|
+
npm i lamix
|
|
106
|
+
|
|
107
|
+
npm install mysql2 dotenv bcrypt
|
|
108
|
+
|
|
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
|
+
# TO See All the Available CLI Commands Run in Terminal
|
|
118
|
+
npm run artisan --
|