[arch-general] [PATCH 2/3] Fixing south scripts

Dan McGee dpmcgee at gmail.com
Fri Sep 17 17:14:01 EDT 2010


On Fri, Sep 17, 2010 at 3:35 PM, Angel Velasquez <angvp at archlinux.org> wrote:
> Table main_mirror was renamed to mirror_mirrors then it fails at the
> time to re-create the schema

You're doing this completely wrong. Migrations apply sequentially. If
you can not build a database from scratch using syncdb, please let me
see those errors here. You will want to add depends as necessary to
the migrations, not change past migrations that applied when they were
created.

-Dan

> Signed-off-by: Angel Velasquez <angvp at archlinux.org>
> ---
>  main/migrations/0008_mirror_tiering.py             |    8 ++++----
>  main/migrations/0009_mirror_rsync_credentials.py   |    8 ++++----
>  main/migrations/0010_kill_rsync_ip_hostname.py     |    4 ++--
>  main/migrations/0011_mirror_notes_text_field.py    |    4 ++--
>  .../migrations/0014_mirror_notes_rsync_optional.py |    8 ++++----
>  5 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/main/migrations/0008_mirror_tiering.py b/main/migrations/0008_mirror_tiering.py
> index 3993289..9dfbd6f 100644
> --- a/main/migrations/0008_mirror_tiering.py
> +++ b/main/migrations/0008_mirror_tiering.py
> @@ -5,15 +5,15 @@ from main.models import *
>  class Migration:
>     def forwards(self, orm):
>         # Adding field 'Mirror.tier'
> -        db.add_column('main_mirror', 'tier', orm['main.mirror:tier'])
> +        db.add_column('mirrors_mirror', 'tier', orm['main.mirror:tier'])
>         # Adding field 'Mirror.upstream'
> -        db.add_column('main_mirror', 'upstream', orm['main.mirror:upstream'])
> +        db.add_column('mirrors_mirror', 'upstream', orm['main.mirror:upstream'])
>
>     def backwards(self, orm):
>         # Deleting field 'Mirror.tier'
> -        db.delete_column('main_mirror', 'tier')
> +        db.delete_column('mirrors_mirror', 'tier')
>         # Deleting field 'Mirror.upstream'
> -        db.delete_column('main_mirror', 'upstream_id')
> +        db.delete_column('mirrors_mirror', 'upstream_id')
>
>     models = {
>         'auth.group': {
> diff --git a/main/migrations/0009_mirror_rsync_credentials.py b/main/migrations/0009_mirror_rsync_credentials.py
> index bbfc9d6..274490f 100644
> --- a/main/migrations/0009_mirror_rsync_credentials.py
> +++ b/main/migrations/0009_mirror_rsync_credentials.py
> @@ -5,15 +5,15 @@ from main.models import *
>  class Migration:
>     def forwards(self, orm):
>         # Adding field 'Mirror.rsync_user'
> -        db.add_column('main_mirror', 'rsync_user', orm['main.mirror:rsync_user'])
> +        db.add_column('mirrors_mirror', 'rsync_user', orm['main.mirror:rsync_user'])
>         # Adding field 'Mirror.rsync_password'
> -        db.add_column('main_mirror', 'rsync_password', orm['main.mirror:rsync_password'])
> +        db.add_column('mirrors_mirror', 'rsync_password', orm['main.mirror:rsync_password'])
>
>     def backwards(self, orm):
>         # Deleting field 'Mirror.rsync_user'
> -        db.delete_column('main_mirror', 'rsync_user')
> +        db.delete_column('mirrors_mirror', 'rsync_user')
>         # Deleting field 'Mirror.rsync_password'
> -        db.delete_column('main_mirror', 'rsync_password')
> +        db.delete_column('mirrors_mirror', 'rsync_password')
>
>     models = {
>         'auth.group': {
> diff --git a/main/migrations/0010_kill_rsync_ip_hostname.py b/main/migrations/0010_kill_rsync_ip_hostname.py
> index 105fced..86d9a92 100644
> --- a/main/migrations/0010_kill_rsync_ip_hostname.py
> +++ b/main/migrations/0010_kill_rsync_ip_hostname.py
> @@ -5,11 +5,11 @@ from main.models import *
>  class Migration:
>     def forwards(self, orm):
>         # Deleting field 'MirrorRsync.hostname'
> -        db.delete_column('main_mirrorrsync', 'hostname')
> +        db.delete_column('mirrors_mirrorrsync', 'hostname')
>
>     def backwards(self, orm):
>         # Adding field 'MirrorRsync.hostname'
> -        db.add_column('main_mirrorrsync', 'hostname', orm['main.mirrorrsync:hostname'])
> +        db.add_column('mirrors_mirrorrsync', 'hostname', orm['main.mirrorrsync:hostname'])
>
>     models = {
>         'auth.group': {
> diff --git a/main/migrations/0011_mirror_notes_text_field.py b/main/migrations/0011_mirror_notes_text_field.py
> index cb6347d..2bcc34d 100644
> --- a/main/migrations/0011_mirror_notes_text_field.py
> +++ b/main/migrations/0011_mirror_notes_text_field.py
> @@ -6,12 +6,12 @@ class Migration:
>     def forwards(self, orm):
>         # Changing field 'Mirror.notes'
>         # (to signature: django.db.models.fields.TextField(blank=True))
> -        db.alter_column('main_mirror', 'notes', orm['main.mirror:notes'])
> +        db.alter_column('mirrors_mirror', 'notes', orm['main.mirror:notes'])
>
>     def backwards(self, orm):
>         # Changing field 'Mirror.notes'
>         # (to signature: django.db.models.fields.CharField(max_length=255, blank=True))
> -        db.alter_column('main_mirror', 'notes', orm['main.mirror:notes'])
> +        db.alter_column('mirrors_mirror', 'notes', orm['main.mirror:notes'])
>
>     models = {
>         'auth.group': {
> diff --git a/main/migrations/0014_mirror_notes_rsync_optional.py b/main/migrations/0014_mirror_notes_rsync_optional.py
> index 21d1362..b4867a8 100644
> --- a/main/migrations/0014_mirror_notes_rsync_optional.py
> +++ b/main/migrations/0014_mirror_notes_rsync_optional.py
> @@ -5,15 +5,15 @@ from main.models import *
>  class Migration:
>     def forwards(self, orm):
>         # Changing field field 'Mirror.rsync_user'
> -        db.alter_column('main_mirror', 'rsync_user', orm['main.mirror:rsync_user'])
> +        db.alter_column('mirrors_mirror', 'rsync_user', orm['main.mirror:rsync_user'])
>         # Changing field 'Mirror.rsync_password'
> -        db.alter_column('main_mirror', 'rsync_password', orm['main.mirror:rsync_password'])
> +        db.alter_column('mirrors_mirror', 'rsync_password', orm['main.mirror:rsync_password'])
>
>     def backwards(self, orm):
>         # Changing field field 'Mirror.rsync_user'
> -        db.alter_column('main_mirror', 'rsync_user', orm['main.mirror:rsync_user'])
> +        db.alter_column('mirrors_mirror', 'rsync_user', orm['main.mirror:rsync_user'])
>         # Changing field 'Mirror.rsync_password'
> -        db.alter_column('main_mirror', 'rsync_password', orm['main.mirror:rsync_password'])
> +        db.alter_column('mirrors_mirror', 'rsync_password', orm['main.mirror:rsync_password'])
>
>     models = {
>         'auth.group': {
> --
> 1.7.2.3
>
>


More information about the arch-general mailing list