Comments (3)
Sounds fine and convenient. I'd be up to review and merge if someone submitted such PR.
Implementation probably requires implementing customResolver for umzug that resolves database entries with fallback to local files. As well as changing implementation of storage so it returns list of migrations from both database and local filesystem.
Other things to note:
- It needs to be backward-compatible, so engine should ensure before migration that column storing migration code is present or create and populate it in transaction otherwise (ensureTable method in engine).
- Obviously it should also properly handle case when no migration table is present
- It should support dry run
- It should support
--to
argument - ???
from knex-migrate.
Also the behavior of the command you're imagining is different than both up
(that is able to run only up migrations) and down
(that executes only down migrations). It would need to figure out what is the common denominator for code migrations and database migrations, migrate down there, and then migrate upward with all remaining code migrations.
This command would be as dangerous as knex-migrate down
, so we probably need a --force
flag if running in production environment (NODE_ENV=production). knex-migrate up
should be enough for production and is usually harmless, so no --force
is necessary there.
I guess we could name it knex-migrate sync
or something.
from knex-migrate.
Sorry I forgot to get back to you on this. After some more thought, I don't think this would be a very good idea.
One major issue I didn't consider when I opened this issue is dependencies. Consider making a new branch, npm i moment
, then making and applying a new migration that uses moment. Switching back to master, npm i
to remove moment, then knex-migrate down
wouldn't work, even with the solution is proposed above.
I'm also using external .sql
files in my migrations in a few places. These wouldn't be present either.
For those reasons, I'm going to close this for now. Feel free to reopen if you can think of a better solution to the problem.
from knex-migrate.
Related Issues (20)
- --only now requires full migration name HOT 1
- Allow a pre-configured knex implementation to be passed to the API HOT 4
- --knexfile argument doesn't work with redo HOT 1
- Use typescript (*.ts) file for migrations file HOT 13
- Which command create migrations table?
- No knexfile at ... HOT 5
- knex-migrate: command not found. HOT 2
- Migration file pattern dosen't match HOT 1
- Umzug Error: "Migration is not pending" HOT 1
- Use knex defined stub if it exists
- ES6 support (arrow function)
- SyntaxError: missing ) after argument list HOT 2
- using a pre-configured knex object HOT 1
- Support migrations.schemaName HOT 1
- Migrations started with knex_migrate do not have '_lock' table HOT 4
- Passing config object to knex-migrate('redo') is not parsed. HOT 1
- Support for TypeScript supporting version of knex migrate command HOT 3
- QUESTION: There is support for generate automatic migration files? HOT 1
- Add knex_migrate table check for Sql Server
- Typescript support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knex-migrate.