@h3ravel/arquebus 0.4.1 → 0.6.0
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 +20 -1
- package/bin/index.cjs +225 -171
- package/bin/index.js +208 -122
- package/bin/seeders-8GJzfIIN.js +3 -0
- package/bin/seeders-ByeSoCAQ.cjs +131 -0
- package/bin/seeders-CltigymO.js +79 -0
- package/bin/seeders-_xJ6VGVS.cjs +3 -0
- package/dist/browser/index.cjs +9 -9
- package/dist/browser/index.d.cts +3655 -183
- package/dist/browser/index.d.ts +3655 -183
- package/dist/browser/index.js +9 -9
- package/dist/index.cjs +270 -135
- package/dist/index.d.cts +3797 -294
- package/dist/index.d.ts +3797 -294
- package/dist/index.js +263 -133
- package/dist/inspector/index.cjs +122 -46
- package/dist/inspector/index.js +119 -46
- package/dist/migrations/index.cjs +171 -151
- package/dist/migrations/index.d.cts +3510 -27
- package/dist/migrations/index.d.ts +3510 -27
- package/dist/migrations/index.js +177 -150
- package/dist/migrations/stubs/migration-js.stub +1 -1
- package/dist/migrations/stubs/migration-ts.stub +1 -1
- package/dist/migrations/stubs/migration.create-js.stub +5 -5
- package/dist/migrations/stubs/migration.create-ts.stub +5 -5
- package/dist/migrations/stubs/migration.update-js.stub +2 -2
- package/dist/migrations/stubs/migration.update-ts.stub +3 -3
- package/dist/seeders/index.cjs +141 -0
- package/dist/seeders/index.d.cts +4766 -0
- package/dist/seeders/index.d.ts +4766 -0
- package/dist/seeders/index.js +118 -0
- package/dist/seeders/index.ts +3 -0
- package/dist/seeders/runner.ts +102 -0
- package/dist/seeders/seeder-creator.ts +42 -0
- package/dist/seeders/seeder.ts +10 -0
- package/dist/stubs/seeder-js.stub +13 -0
- package/dist/stubs/seeder-ts.stub +9 -0
- package/package.json +15 -4
- package/types/builder.ts +158 -80
- package/types/container.ts +79 -66
- package/types/generics.ts +75 -36
- package/types/modeling.ts +213 -158
- package/types/query-builder.ts +223 -186
- package/types/query-methods.ts +160 -104
- package/types/utils.ts +64 -55
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[![Framework][ix]][lx]
|
|
8
8
|
[![Arquebus ORM][i1]][l1]
|
|
9
|
-
[![Downloads][d1]][
|
|
9
|
+
[![Downloads][d1]][l1]
|
|
10
10
|
[![Tests][tei]][tel]
|
|
11
11
|
[![License][lini]][linl]
|
|
12
12
|
|
|
@@ -94,6 +94,25 @@ const users = await User.query()
|
|
|
94
94
|
await user.load('posts');
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## Seeders
|
|
98
|
+
|
|
99
|
+
- Create a seeder: `npx arquebus make:seeder UsersSeeder`
|
|
100
|
+
- Run seeders: `npx arquebus db:seed` or `npx arquebus db:seed --path ./database/seeders`
|
|
101
|
+
- Seeder class example (TypeScript):
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { Seeder } from '@h3ravel/arquebus';
|
|
105
|
+
import type QueryBuilder from '@h3ravel/arquebus/types/query-builder';
|
|
106
|
+
|
|
107
|
+
export default class UsersSeeder extends Seeder {
|
|
108
|
+
async run(connection: QueryBuilder) {
|
|
109
|
+
await connection.table('users').insert({ name: 'Alice' });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Seeders execute with the same connection setup as migrations. The CLI resolves paths from `--basePath` and `--path` and loads seeders from `.ts`/`.js` files exporting a default class with a `run` method.
|
|
115
|
+
|
|
97
116
|
## Show Your Support
|
|
98
117
|
|
|
99
118
|
Please ⭐️ this repository if this project helped you
|