valdergallo / django-reset-migrations Goto Github PK
View Code? Open in Web Editor NEWAdd one command to reset the django migrations
License: Apache License 2.0
Add one command to reset the django migrations
License: Apache License 2.0
python manage.py reset_migrations treasure
I suggest reason is cyrillic symbols in my project files.
Thank you!
Resetting voucher
from https://github.com/django-oscar/django-oscar caused an error - it has a problem with the dependency app basket
.
Reseting APP ['voucher']
Deleting APP (voucher) in database
Deleting APP (voucher) migrations files
Deleting dependences in migrations for (voucher)
APP (voucher) deleted with success
Traceback (most recent call last):
File "./manage.py", line 46, in <module>
main()
File "./manage.py", line 42, in main
execute_from_command_line(sys.argv)
File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3.8/site-packages/reset_migrations/management/commands/reset_migrations.py", line 78, in handle
call_command('makemigrations', *apps)
File "/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 168, in call_command
return command.execute(*args, **defaults)
File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3.8/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/django/core/management/commands/makemigrations.py", line 101, in handle
loader.check_consistent_history(connection)
File "/usr/lib/python3.8/site-packages/django/db/migrations/loader.py", line 295, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration basket.0003_basket_vouchers is applied before its dependency voucher.0001_initial on database 'default'.
Example:
If I need reset migrations starting from my third migration:
python manage.py reset_migration app1 --starting 003
It'd be nice if the package would be made compatible with python3, or a comment is made that it's not.
So, let's say I have a model Car in the code with some changes.
These changes have not been applied, and I try to run reset_migrations.
ALL the migrations will be faked, including the last migration which has the changes of the Car model. So it's never actually applied.
Thanks for your good work!
Hi Man,
I'm trying to use your script and after run
python manage.py reset_migrations app1 app2 app3...
I got this
..../reset_migrations.py", line 17, in delete_line
print_function('Deleting line in %s' % filename)
AttributeError: _Feature instance has no call method
Do you have any idea what's going on?
***My apps has dependencies
thanks in advance :)
it should be straight forward.
Thanks,
It's a very minor issue, but I notice two typos in README.MD.
There are a couple of references to "INSTALL_APPS" but they should say "INSTALLED_APPS".
I realize most people already would already know what it should say, but there might be newbies who take the instruction literally.
Love this.
Would be even better with an option to drop the tables that it just reset and apply the new initial migration.
It may want an "Are you sure?" prompt to minimize risk of accidents and a -y or -f option to to answer yes automatically or force that (for scripts).
This is admittedly for a particular use case at the outset of a project when models are evolving rapidly and there is no live data yet per se, and whatever data is in there is from initial and test fixtures and easy to reload anyhow.
This extra feature would bring this use case into its one command turn-key solution scope. And would rock.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.