schwifty-migration
Objection.js model migration tool for use during development
AnGetting Started
- Run
npm install
- Install the right version of 'schwifty'
npm install git+https://github.com/BigRoomStudios/schwifty.git#add-schwifty-migration
- Install 'schwifty-migration'
npm install git+https://github.com/BigRoomStudios/schwifty-migration.git
- Create an npm 'migrate' script so that schwifty's
migrationsMode
plugin option is set to either 'create' or 'alter'.
Ex.
// package.json
"scripts": {
"migrate": "MIGRATE=alter npm start"
}
- Now Go to where
schwifty
gets registered on your server (server/manifest.js for example), and add themigrationsMode
plugin option.
Ex.
$base: { migrateOnStart: true,+ migrationsMode: process.env.MIGRATE, knex: { client: 'sqlite3', useNullAsDefault: true, connection: { filename: ':memory:' } }}
- If all goes well, the process will stop and the generated migration file location will be printed to the console. It'll look like this:
//////////////////////////
/////// Success! /////////
Generated new migration file:
/Users/$(whoami)/path/to/migrations/20170817143549_schwifty-migration.js
- Pro-tip: Triple click the line with the filepath, copy, then run
atom
+ paste in terminal to edit the file in Atom.