-
-
Notifications
You must be signed in to change notification settings - Fork 360
Reduce boilerplate code when running migrations from SQL files #452
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
Comments
Duplicate of #401 |
@maxsummers Please have a look in the other issue I linked above and read my comments over there, I have already stated about some things that need to be in place to actually do what you ask for. Fact is: SQL migrations currently do not exist, there is just a template and you basically still use javascript migrations. So yes this is true, but this is a migration framework that started with just javascript, so this is nothing that would be unexpected. So far there are plans to support raw SQL in a more native way, just like this is true now for |
@maxsummers this was driving me nuts so I pulled the boilerplate out into a separate package that you can use: https://www.npmjs.com/package/db-migrate-boilerplate This simplifies what you're committing into your repo to: 'use strict'
const path = require('path')
const boilerplate = require('db-migrate-boilerplate')
module.exports = boilerplate({
upPath: path.join(__dirname, 'sqls', '20161226111110-test-up.sql'),
downPath: path.join(__dirname, 'sqls', '20161226111110-test-down.sql')
}) |
@troygoode :) +1 I've made some thoughts about that again, and it might be quite a good option to handle the word |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
When
sql-file
option is used it creates the following migration file:This is a huge amount of non-optimized boilerplate code.
It's pretty common to have hundreds of migrations in actively developed project. Now, consider this boilerplate multiplied by one hundred. This will increase code base size significantly and will take additional time for IDE to analyze the code and build it's indices.
Please, consider to reduce the size of such migration files. I think the only relevant part of it is:
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40399864-reduce-boilerplate-code-when-running-migrations-from-sql-files?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github).__dirname, 'sqls', '20161226111110-test-down.sql'
, so everything else could be moved to the library code.The text was updated successfully, but these errors were encountered: