-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3395 from specklesystems/fabians/quick-js-to-ts-1
chore(server): easy js to ts migrations #1
- Loading branch information
Showing
12 changed files
with
110 additions
and
92 deletions.
There are no files selected for viewing
11 changes: 7 additions & 4 deletions
11
...server/modules/cli/commands/db/migrate.js → ...server/modules/cli/commands/db/migrate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
/** @type {import('yargs').CommandModule} */ | ||
const command = { | ||
import { noop } from 'lodash' | ||
import { CommandModule } from 'yargs' | ||
|
||
const command: CommandModule = { | ||
command: 'migrate', | ||
describe: 'Migration specific commands', | ||
builder(yargs) { | ||
return yargs.commandDir('migrate', { extensions: ['js', 'ts'] }).demandCommand() | ||
} | ||
}, | ||
handler: noop | ||
} | ||
|
||
module.exports = command | ||
export = command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
packages/server/modules/cli/commands/db/migrate/rollback.js
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
packages/server/modules/cli/commands/db/migrate/rollback.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import knex from '@/db/knex' | ||
import { logger } from '@/logging/logging' | ||
import { CommandModule } from 'yargs' | ||
|
||
const command: CommandModule = { | ||
command: 'rollback', | ||
describe: 'Roll back all migrations', | ||
async handler() { | ||
logger.info('Rolling back migrations...') | ||
await knex.migrate.rollback(undefined, true) | ||
logger.info('Completed rolling back migrations') | ||
} | ||
} | ||
|
||
export = command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 7 additions & 4 deletions
11
...es/server/modules/cli/commands/db/seed.js → ...es/server/modules/cli/commands/db/seed.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
/** @type {import('yargs').CommandModule} */ | ||
const command = { | ||
import { noop } from 'lodash' | ||
import { CommandModule } from 'yargs' | ||
|
||
const command: CommandModule = { | ||
command: 'seed', | ||
describe: 'Seed your local DB with fake data', | ||
builder(yargs) { | ||
return yargs.commandDir('seed', { extensions: ['js', 'ts'] }).demandCommand() | ||
} | ||
}, | ||
handler: noop | ||
} | ||
|
||
module.exports = command | ||
export = command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters