create-sip 1.4.2 → 1.4.4
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/expressapi/docs/user_doc.md +60 -1
- package/expressapi/op +1 -1
- package/expressapi/package-lock.json +3 -0
- package/package.json +1 -1
|
@@ -204,6 +204,41 @@ Generate a migration:
|
|
|
204
204
|
node op make/migration thing
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
+
For example migration for employee table:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
node op make/migration employee
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
import { DataTypes } from 'sequelize';
|
|
215
|
+
|
|
216
|
+
async function up({context: QueryInterface}) {
|
|
217
|
+
await QueryInterface.createTable('employees', {
|
|
218
|
+
id: {
|
|
219
|
+
allowNull: false,
|
|
220
|
+
autoIncrement: true,
|
|
221
|
+
primaryKey: true,
|
|
222
|
+
type: DataTypes.INTEGER
|
|
223
|
+
},
|
|
224
|
+
name: {
|
|
225
|
+
type: DataTypes.STRING
|
|
226
|
+
},
|
|
227
|
+
city: {
|
|
228
|
+
type: DataTypes.STRING
|
|
229
|
+
},
|
|
230
|
+
createdAt: { type: DataTypes.DATE },
|
|
231
|
+
updatedAt: { type: DataTypes.DATE }
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async function down({context: QueryInterface}) {
|
|
236
|
+
await QueryInterface.dropTable('employees');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export { up, down }
|
|
240
|
+
```
|
|
241
|
+
|
|
207
242
|
Run all migration:
|
|
208
243
|
|
|
209
244
|
```bash
|
|
@@ -218,7 +253,7 @@ node op migration:run <migration_name>
|
|
|
218
253
|
node op migrate <migration_name>
|
|
219
254
|
```
|
|
220
255
|
|
|
221
|
-
Rollback
|
|
256
|
+
Rollback the last migration:
|
|
222
257
|
|
|
223
258
|
```bash
|
|
224
259
|
node op migration:rollback
|
|
@@ -239,6 +274,8 @@ node op migration:reset
|
|
|
239
274
|
node op migrate:reset
|
|
240
275
|
```
|
|
241
276
|
|
|
277
|
+
This command also undoes seeder operations.
|
|
278
|
+
|
|
242
279
|
Reset the database and run all migrations:
|
|
243
280
|
|
|
244
281
|
```bash
|
|
@@ -254,6 +291,28 @@ Generate a seeder:
|
|
|
254
291
|
node op make/seeder thing
|
|
255
292
|
```
|
|
256
293
|
|
|
294
|
+
Example seeder for employee table:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
node op make/seeder employee
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
```javascript
|
|
301
|
+
|
|
302
|
+
async function up({context: QueryInterface}) {
|
|
303
|
+
await QueryInterface.bulkInsert('employees', [
|
|
304
|
+
{ id: 1, name: 'Joe Kitin' },
|
|
305
|
+
{ id: 2, name: 'Peter Fall' }
|
|
306
|
+
]);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
async function down({context: QueryInterface}) {
|
|
310
|
+
await QueryInterface.bulkDelete('things', null, {});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export { up, down }
|
|
314
|
+
````
|
|
315
|
+
|
|
257
316
|
Run all seeders:
|
|
258
317
|
|
|
259
318
|
```bash
|
package/expressapi/op
CHANGED
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
|
88
88
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
|
89
89
|
"license": "MIT",
|
|
90
|
+
"peer": true,
|
|
90
91
|
"engines": {
|
|
91
92
|
"node": ">=12"
|
|
92
93
|
},
|
|
@@ -238,6 +239,7 @@
|
|
|
238
239
|
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz",
|
|
239
240
|
"integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==",
|
|
240
241
|
"license": "MIT",
|
|
242
|
+
"peer": true,
|
|
241
243
|
"engines": {
|
|
242
244
|
"node": "^14.21.3 || >=16"
|
|
243
245
|
},
|
|
@@ -608,6 +610,7 @@
|
|
|
608
610
|
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz",
|
|
609
611
|
"integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==",
|
|
610
612
|
"license": "MIT",
|
|
613
|
+
"peer": true,
|
|
611
614
|
"dependencies": {
|
|
612
615
|
"fast-deep-equal": "^3.1.3",
|
|
613
616
|
"json-schema-traverse": "^1.0.0",
|