Git Product home page Git Product logo

Comments (3)

timster avatar timster commented on May 19, 2024

Yes, that's the right functionality.

Running create generates the initial create_table commands but it does not have the ability to detect changes in models.

If you add a column to your model, you'll need to generate a new migration and add the add_column statement manually.

flask db revision "add content to tweet"

Then update your migration:

def upgrade(migrator):
    migrator.add_column('tweet', 'content', 'text')

def downgrade(migrator):
    migrator.drop_column('tweet', 'content')

from peewee-moves.

faanbece avatar faanbece commented on May 19, 2024
  • Are there plans to implement this feature in the future?
  • This software is considered complete as is?
  • Or in case I can contribute to the development of this feature, will my pull request be accepted?

from peewee-moves.

timster avatar timster commented on May 19, 2024

I think it would be a great feature to have. I have no plans to implement it, mostly because I don't have time to dedicate to it.

I have given it much thought though. There are many different changes to a model that could take place like...

  1. adding a column
  2. removing a column
  3. renaming a column
  4. changing column data type
  5. changing column length
  6. and more...

Django and Alembic have both solved this, but using different strategies. Django keeps track of model history (it knows what your models look like before each change). I wouldn't be opposed to doing something like that, but it's definitely more complex.

Adding a column and removing a column are the easiest to detect and quite common actions, so even if it were able to do that, I think it would be helpful.

I will gladly accept pull requests for this feature (or any other feature for that matter). I don't use this library too often anymore, but if it's useful to other people I'd like to keep it alive. I'd be glad to help with development as well, I just don't have time to do it completely in any reasonable time frame.

from peewee-moves.

Related Issues (7)

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.