gina-sequelize 0.0.10 → 0.0.11
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/.vscode/settings.json +5 -0
- package/bin/index.ts +14 -7
- package/package.json +1 -1
package/bin/index.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env ts-node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
7
|
+
const yargs = require('yargs/yargs');
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
|
+
const { hideBin } = require('yargs/helpers');
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
11
|
+
const { readdir, mkdir, writeFile } = require('fs/promises');
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
|
+
const moment = require('moment');
|
|
7
14
|
|
|
8
15
|
async function createInitialFolder() {
|
|
9
16
|
const files = await readdir('.');
|
|
@@ -106,7 +113,7 @@ export { initializeModels };
|
|
|
106
113
|
|
|
107
114
|
}
|
|
108
115
|
|
|
109
|
-
async function generateMigration(migrationName
|
|
116
|
+
async function generateMigration(migrationName) {
|
|
110
117
|
try {
|
|
111
118
|
const pathName = process.cwd();
|
|
112
119
|
const initFile = await import(pathName + '/gina/initializeModels.ts');
|
|
@@ -143,7 +150,7 @@ async function upgrade() {
|
|
|
143
150
|
const files = (await readdir(pathName + '/gina/migrations')).filter(file => !file.includes('.d.ts') && !file.includes('.js.map'));
|
|
144
151
|
|
|
145
152
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
-
const migrations
|
|
153
|
+
const migrations = {};
|
|
147
154
|
|
|
148
155
|
for (const file of files) {
|
|
149
156
|
const filePath = await import(pathName + '/gina/migrations/' + file);
|
|
@@ -177,7 +184,7 @@ yargs(hideBin(process.argv))
|
|
|
177
184
|
describe: 'Name of the migration to be added'
|
|
178
185
|
});
|
|
179
186
|
}, (argv) => {
|
|
180
|
-
generateMigration(argv['migration-name']
|
|
187
|
+
generateMigration(argv['migration-name']);
|
|
181
188
|
})
|
|
182
189
|
.command('upgrade', 'upgrade database to its last revision', () => {
|
|
183
190
|
upgrade();
|
package/package.json
CHANGED