Skip to content

Commit

Permalink
feat: migrate db config files
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Dec 24, 2019
1 parent f9907da commit 6ce6ce2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/@nodepack/plugin-db-fauna/src/app-migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,16 @@ module.exports = (api: MigratorAPI) => {
api.unrender(configTemplate)
},
})

api.register({
id: 'configRename',
title: 'Rename config file',
when: api => api.fromVersion('<0.8.0'),
up: (api, options) => {
api.move('config/db.{js,ts}', file => `${file.path}fauna.${file.ext}`)
},
down: (api, options) => {
api.move('config/fauna.{js,ts}', file => `${file.path}db.${file.ext}`)
},
})
}
12 changes: 12 additions & 0 deletions packages/@nodepack/plugin-db-knex/src/app-migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,16 @@ module.exports = (api: MigratorAPI) => {
api.unrender(configTemplate)
},
})

api.register({
id: 'configRename',
title: 'Rename config file',
when: api => api.fromVersion('<0.8.0'),
up: (api, options) => {
api.move('config/db.{js,ts}', file => `${file.path}knex.${file.ext}`)
},
down: (api, options) => {
api.move('config/knex.{js,ts}', file => `${file.path}db.${file.ext}`)
},
})
}
12 changes: 12 additions & 0 deletions packages/@nodepack/plugin-db-sequelize/src/app-migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,16 @@ module.exports = api => {
api.unrender(exampleTemplate)
},
})

api.register({
id: 'configRename',
title: 'Rename config file',
when: api => api.fromVersion('<0.8.0'),
up: (api, options) => {
api.move('config/db.{js,ts}', file => `${file.path}sequelize.${file.ext}`)
},
down: (api, options) => {
api.move('config/sequelize.{js,ts}', file => `${file.path}db.${file.ext}`)
},
})
}

0 comments on commit 6ce6ce2

Please sign in to comment.