mozillahispano / mozbuzz

Tracking tool for media mentions
http://www.mozilla-hispano.org
15 stars 25 forks source link

manage.py migrate fails #62

Closed milmazz closed 7 years ago

milmazz commented 10 years ago

I'm trying to install the development branch, I followed the instructions and everything it's fine until I try to run the following command:

➜  mozbuzz (development) python manage.py migrate
Running migrations for buzz:
 - Migrating forwards to 0010_datamigration_rates.
 > buzz:0001_initial
 > buzz:0002_auto__add_field_source_disabled__chg_field_source_creation_date__add_f
 > buzz:0003_auto__add_followup__add_followupstatus__chg_field_source_creation_user
 > buzz:0004_add_field_Mention_country_add_field_Mention_product
 > buzz:0005_add_column_source_name
 > buzz:0006_null_fields
 > buzz:0007_auto__add_rssfeed__add_rsspost
 > buzz:0008_auto__add_field_rssfeed_product
FailedDryRun:  ! Error found during dry run of '0008_auto__add_field_rssfeed_product'! Aborting.
Traceback (most recent call last):
  File "/Users/milmazz/Development/mozbuzz/env/lib/python2.7/site-packages/south/migration/migrators.py", line 170, in _run_migration
    migration_function()
  File "/Users/milmazz/Development/mozbuzz/env/lib/python2.7/site-packages/south/migration/migrators.py", line 59, in <lambda>
    return (lambda: direction(orm))
  File "/Users/milmazz/Development/mozbuzz/mozbuzz/buzz/migrations/0008_auto__add_field_rssfeed_product.py", line 12, in forwards
    db.add_column('buzz_rssfeed', 'product', self.gf('django.db.models.fields.related.ForeignKey')(related_name='feeds', to=orm['buzz.Product']), keep_default=False)
  File "/Users/milmazz/Development/mozbuzz/env/lib/python2.7/site-packages/south/db/sqlite3.py", line 25, in add_column
    raise ValueError("You cannot add a null=False column without a default value.")
ValueError: You cannot add a null=False column without a default value.

According to the traceback the problem is in the South migration file mozbuzz/buzz/migrations/0008_auto__add_field_rssfeed_product.py, it's missing a default value. If you give me a hint I can try to resolve this issue.

milmazz commented 10 years ago

Hi, after a few searches I see some similar reports in other open source projects like django-cms and django-mutant. Until now I can installed mozbuzz with this series of steps:

$ rm -f db.sqlite3
$ python manage.py syncdb
$ python manage.py migrate
$ python manage.py migrate —fake mozbuzz.buzz 0008

After this I recreate the table buzz_rssfeed with the new column product via SQLite CLI, and now I can finish the installation process as follows:

$ python manage.py migrate
$ python manage.py runserver

Of course, this is not the best way to approach the installation process, but in the meantime it can work as a workaround.

sebasmagri commented 10 years ago

@milmazz would you help us looking at the problematic migration and working on a fix for environments with initial data and without initial data?

diegoduncan21 commented 10 years ago

no tuve yo estos problemas, migró todo correctamente al instalar migration_status

milmazz commented 7 years ago

I haven't check this in a while, sorry guys, I'll close this issue.