Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw sql migrations support #3

Open
shedar opened this issue Jun 12, 2015 · 0 comments
Open

Raw sql migrations support #3

shedar opened this issue Jun 12, 2015 · 0 comments

Comments

@shedar
Copy link

shedar commented Jun 12, 2015

Knex has a powerful schema builder. But, as you mentioned in knex 2015 roadmap, it’s still limited. I’d suggest to add a raw sql migrations.
Each migration will have two files: datetime_name_up.sql and datetime_name_down.sql

For now I use following code in migration js file for raw migrations

var migrationUtils = require('../../src/helpers/migrations/migrations');
exports.up = migrationUtils.getUpFunction(__filename);
exports.down = migrationUtils.getDownFunction(__filename);

each of functions reads corresponding (_up or _down) sql file and executes knex.raw with its content. But it causes repeating of each migration js code and gives 3 files per migration.
I can also put raw sql in js, but it’ll break sql syntax highlight and reduce readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant