django-migrations

python manage.py migrate does not make any changes in the postgres database

蓝咒 提交于 2019-12-07 08:20:43
问题 This seems like a simple problem I am not sure what I am doing wrong. If for example I wanted to add a new field in one of my classes in models.py by changing: class FeedBack(models.Model): feedback = models.CharField(max_length=600) user = models.ForeignKey(User,default="") to class FeedBack(models.Model): feedback = models.CharField(max_length=600) email = models.CharField(max_length=100) user = models.ForeignKey(User,default="") then I run python manage.py makemigrations python manage.py

Fix Conflicting migrations detected in Django1.9

喜欢而已 提交于 2019-12-07 00:06:03
问题 I updated django-dynamic-model repository to support Django 1.9. I got this error: CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0001_initial, 0002_auto__add_field_dynamicschemafield_extra in dynamicmodel). To fix them run 'python manage.py makemigrations --merge' After running python manage.py makemigrations --merge , I got another error: File "/local/lib/python2.7/sitepackages/django/core/management/__init__.py", line 353, in execute_from

Cannot get Django 1.7 Migrations to detect proper changes to my DB.

大城市里の小女人 提交于 2019-12-06 22:50:30
I have a production web project running with a decent amount of data in the MySQL db. I am trying to update the database with some changes to an app called "enterlink." I've made new elements in the existing models and created new models altogether. Before this migration, I have never touched the schema of the db since originally running syncdb to create it. When I run: "python manage.py makemigrations enterlink" the below output appears(pic). My question is, why is this happening? The DB already includes all the models that it lists in the picture so why is it registering those lists of

Models inside tests - Django 1.7 issue

旧时模样 提交于 2019-12-06 19:27:06
问题 I'm trying to port my project to use Django 1.7. Everything is fine except 1 thing. Models inside tests folders. Django 1.7 new migrations run migrate command internally. Before syncdb was ran. That means if a model is not included in migrations - it won't be populated to DB (and also to test DB). That's exactly what I'm experiencing right now. What I do is: In my /app/tests/models.py I have dummy model: class TestBaseImage(BaseImage): pass All it does is to inherit from an abstract BaseImage

django migration hell, dropped a table. Tried to get it back

北城以北 提交于 2019-12-06 15:34:19
So I dropped a table in my database, and I want it back. Rerunning a migration gave errors table didn't exist. After some hunting I learned I could remove everything in my django_migrations that had app name my app. So i did that, reran migrations it started to work then griped about tables that were not dropped. I have no idea how to just get the one table back again and keep everything as it was... anyway to do this? I don't care about 90% of the data in the database, only a few tables and fields. The table i dropped i cared nothing about the data. Start by inspecting the django_migrations

Django migrations and customizable reusable apps

徘徊边缘 提交于 2019-12-06 05:39:47
问题 I started writing my first reusable app about 3 weeks ago, and I'm having troubles to deal with migrations. I want some points of my app to be customizable. Thus I have a conf submodule that defines custom settings and assign the reasonable defaults that will fit most cases. This leads some of my model fields to look like this: attachment = models.FilePathField( path=conf.ATTACHMENTS_DIR, recursive=True) template_file = models.FileField( upload_to=conf.TEMPLATES_UPLOAD_DIR, blank=True) prefix

Django: Providing initial group with migrations

半腔热情 提交于 2019-12-06 04:10:09
Since the using of an initial_data fixture is deprecated, I'm trying to add initial data with a migration. I created my models, and one of the models contains a permission code-named can_use_feature . When I run a makemigrations , a 0001_initial.py migration is created. The migrate command creates the database, well populated and the permission from above is in the auth_permission table. Now I want to have a group with that permission by default in the database, so I create this migration as 0002_default_group.py : from __future__ import unicode_literals from django.db import migrations def

ValueError in Django when running the “python manage.py migrate” command

余生颓废 提交于 2019-12-05 18:22:25
问题 I needed to add more fields to Django's User model, so I created a custom model class (named Accounts in an app named accounts ) that extends Django's AbstractUser class. After that, I updated my settings.py file, defining the AUTH_USER_MODEL property : AUTH_USER_MODEL = 'accounts.Accounts' I then created a migration file for the custom model using the python manage.py makemigrations command. After that, I ran the python manage.py migrate command and I got this error message: ValueError: The

Django proxy model to different database

拈花ヽ惹草 提交于 2019-12-05 13:39:39
问题 Situation We have a few different applications which use tickets from a ticket support system for different kinds of functionality. First of all we have an application which has a few models that represent the models of our ticket support system Kayako. This application should not know anything about other applications that make use of it and should remain as generic as possible. Since this application is using existing tables of Kayako we have it running on the same database. Let's call this

Django 1.8 migration unable to cast column id to integer

北慕城南 提交于 2019-12-05 12:59:33
问题 I'm migrating my site from an SQLite backend to a Postgres backend. We've been running native-Django style migrations (i.e., not South) from the beginning of the project. Most of the migrations run fine, but there's a hiccup in our of our applications. We got this far in the Postgres migration. (All other apps fully migrated.) All of the migrations ran without incident on SQLite3. processes [X] 0001_initial [X] 0002_auto_20150508_2149 [ ] 0003_auto_20150511_1543 [ ] 0004_auto_20150528_1739 [