I am using south in my Django application and can't understand one thing. I have changed one field from IntegerField to CharField and made after it : manage.py app_name --auto --update. Then I looked at the list of migrations and saw that this migration has number 0014. But when I do manage.py app_name migrate south tries to migrate version 0004. How to specify 0014?
I assume you meant:
manage.py schemamigration app_name --auto --update
not
manage.py app_name --auto --update
You can specify a version with the migrate:
./manage.py migrate app_name 0014
or the full version name:
./manage.py migrate myapp 0014_change_charfield...
Related
I have a requirements so that its not possible to change given schema. I dont need any django inbuild models such as admin,auth,sessions,messages etc..
how can I migrate my models without the inbuild models.
I will be gratefull if you can help me.
Thank you.
You can migrate your own models by doing this:
python manage.py makemigrations appname
python manage.py sqlmigrate appname 0001 #It is autogenerated value after makemigrations
python manage.py migrate
This is the way you can do.
I have MySQL database in backed but when i change any model i does not reflect in backend
python manage.py makemigration app_name
python manage.py migrate
but it show no migrations applied
does mysql does nor support migrations
my model
class blog(models.Model):
name = models.CharField(max_length=10)
try fake migration
python manage.py -fake app_name
Be sure that you already added app_name to INSTALLED_APPS list
I am trying to use schema migration as i have my models in which i had two models previously and i have created three more models.
I have tried several commands like
python manage.py schemamigration appname --add modelname
python manage.py schemamigration appname
python manage.py schemamigration
python manage.py schemamigration appname --fake
but no luck
sometimes it gives me the error
You have not passed any of --initial, --auto, --empty, --add-model, --add-field or --add-index.
and sometimes this one
sage: manage.py schemamigration [options]
Creates a new template schema migration for the given app
manage.py: error: ambiguous option: --add (--add-field, --add-index, --add-model?)
i am new to django so want some help.
Finally got it
python manage.py schemamigration appname --auto
Trying to drop tables with South for app django-activity-stream and then re-add it.
Process I used to drop table:
Deleted all previous migrations for the app to start fresh
Replaced models.py with an empty file
python manage.py schemamigration actstream --initial
python manage.py migrate actstream
But when I look at the database, the tables are still there.
Why aren't the tables dropping -- am I doing something wrong?
Process I would use to drop/re-add table:
Deleted all previous migrations for the app to start fresh
python manage.py schemamigration actstream --initial
python manage.py migrate actstream --fake
Replaced models.py with an empty file
python manage.py schemamigration actstream --auto
python manage.py migrate actstream
Maybe you can omit the 3 step
I've got a Django app with South installed. I added an app ("guardian") in my INSTALLED_APPS. Now when I run python manage.py syncdb I get:
$ python manage.py syncdb
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
No fixtures found.
Synced:
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.sites
> django.contrib.admin
> south
Not synced (use migrations):
- myapp
- guardian
and trying the migration returns:
Nothing seems to have changed.
Is there any way to use the original syncdb, not the South one?
Thanks
Are you running manage.py migrate guardian?
"Nothing seems to have changed" looks like an output of running manage.py schemamigration, which wouldn't create any tables to begin with...
You can remove "south" from INSTALLED_APPS then run syncdb and finally, add "south" to INSTALLED_APPS again.