Giter Site home page Giter Site logo

Comments (3)

sheerun avatar sheerun commented on June 28, 2024

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:

  1. 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).
  2. Obviously it should also properly handle case when no migration table is present
  3. It should support dry run
  4. It should support --to argument
  5. ???

from knex-migrate.

sheerun avatar sheerun commented on June 28, 2024

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.

carlbennettnz avatar carlbennettnz commented on June 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.