Coder Social home page Coder Social logo

Comments (11)

lastland avatar lastland commented on June 15, 2024

Hi, the reason is that all the migration objects must be executed somewhere. I put them in MigrationSummary so they can be executed when MigrationSummary is executed (and MigrationSummary will be executed by MyMigrations).

I think the best solution is to have the empty MigrationSummary in your version control but never commit any changes to it. I'm not familiar with Mercurial. Do you think there is an easy way to do that in Mercurial?

from scala-forklift.

alexkvak avatar alexkvak commented on June 15, 2024

Thanks for answer, I need to try it.
I have one more idea, write soon.

from scala-forklift.

alexkvak avatar alexkvak commented on June 15, 2024

The problem is that we have rolled migrations summary. But we need to have all available migrations in summary and look for their status through the database. In this case we don't need to create symlinks and can commit all changes.
If I could change the migration status source, it would be enough for my case. Could you help me to find the respective code?

from scala-forklift.

lastland avatar lastland commented on June 15, 2024

I'm glad to help. However, I'm not sure I have understood your question.

I would not recommend putting the rolled migrations and migration summary in your version control, because some migrations may depend on the generated code, which may not have been generated on other people's machine.

from scala-forklift.

alexkvak avatar alexkvak commented on June 15, 2024

Ok, let me explain one more time.
I need to easy deploy an application and run tests on teamcity. So, code must be compiled every time. MyMigrations depends on MigrationSummary which contains for now only rolled migrations. I would like to store in MigrationSummary all available migrations. On other hand the status of migrations stored in database, and it's completely enough.

What do you think?

from scala-forklift.

lastland avatar lastland commented on June 15, 2024

If you store all migrations in MigrationSummary you might not be able to compile the code because the code might depend on some generated code which is not generated yet.

If you want to get the status of migrations stored in the database, you can find it out using this method. If you want to modify how migration files and migration summary are handled, you can try to override traits in this file(In particular, handleMigrationFiles for creating symlinks for migration files; writeSummary for putting migrations into the summary file).

from scala-forklift.

lastland avatar lastland commented on June 15, 2024

I think I might see a problem here. If you compile and run a clean copy of the code on a machine with some migrations already applied, there might be a problem: the migrations will not be applied twice, but Forklift will not generate code for current database schemas, either. Not sure if that's a problem you have met. I will try to find some time to fix that over the weekend.

from scala-forklift.

alexkvak avatar alexkvak commented on June 15, 2024

If you store all migrations in MigrationSummary you might not be able to compile the code because the code might depend on some generated code which is not generated yet.

If I deploy the project from scratch I might meet the same problem. So it's the problem of migration code, but not MigrationSummary file.
We should always store the actual DB schema and migration list in repository. It guarantees us always working code.

from scala-forklift.

alexkvak avatar alexkvak commented on June 15, 2024

I overriden handleMigrationFile method, I don't create symlink, but make a hard copy of migration file. In this case application always compiles well.

from scala-forklift.

lastland avatar lastland commented on June 15, 2024

Cool! Guess I should make hard copy an option.

from scala-forklift.

lastland avatar lastland commented on June 15, 2024

Should be fixed by #35

from scala-forklift.

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.