Hynek, --change order of calls in forwards() backwards()-- this is another good info to me. I swear I will investigate a lot of time to become a A1 south migrator!
thx for the help and support! Ionic On Mon, 2011-11-14 at 16:35 -0800, hynekcer wrote: > Ionic, > IMO you can change the order of calls to db.create_table, create_field > etc. in forwards() in *schemamigration* and also change order of > delete_table in backwards(). > Dependent tables and fields should be added later and removed earlier > then the independent ones. > Only with less usual *datamigration*s it could be necessary to divide > one change to more steps. > > On 14 lis, 20:44, ionic drive <[email protected]> wrote: > > The problem was there where some dependencies! I thought I could only > > have them troubling me over multiple apps. But its also a problem in the > > same app in the same models.py file. > > > > So the solution is to do those migrations in stages. > > Not trying to add a field which depends on a field which is added in the > > same migration stage. > > > > South is not directly complaining about a possible dependency issue. its > > just telling the the field does not exist. > > > > sorry for the noise! > > ionic > > > > > > > > > > > > > > > > On Mon, 2011-11-14 at 06:51 -0800, hynekcer wrote: > > > > What did I do wrong? > > > > > Reading South tutorial. The command "schemamigration" is used on the > > > source computer to create migration source code whereas command > > > "migrate" is used on the destination computer. > > > > > ./manage.py migrate satchmo_store.shop --fake 0001 > > > (or the full name 0001_name_of_your_first_migration) > > > > > ./manage.py migrate satchmo_store.shop 0002 > > > > > Yesterday Chris created satchmo_store/shop/migrations/0001_initial.py > > > Now you should read also Team Workflow and merge in > > >http://south.aeracode.org/docs/tutorial/part5.html > > > For your migrations is good convention to rename them to e.g. > > > 0001_1_your_multicurrency and to reserve whole numbers to main > > > Satchmo. > > > 0001_initial is the same as in the main row. > > > After Chris will create 0002_something_new, you will create merged > > > migration 0002_1_merged_something_new_multicurrency > > > 0002_1 > > > > > -- Hynek > > > > > On 14 lis, 09:51, ionic drive <[email protected]> wrote: > > > > I know I could have posted this to django mailing list, too. > > > > But Multi Currency is interesting for you too. And you know > > > > satchmo_store.shop models better than django only guys. > > > > > > The story: > > > > --------- > > > > I am working on Multi Currency > > > > its quite finished and it works. > > > > > > I have tested it on my development environment. > > > > I installed with syncdb --all fresh and this works fine. > > > > BUT: > > > > --- > > > > Now I want to add it to production server. So I have to do a migration. > > > > I want to keep the data stored in production database. (postgresql-8.4) > > > > > > Short how to do a south migration: > > > > --------------------------------- > > > > 1) ./manage.py schemamigration satchmo_store.shop --init > > > > 2) ./manage.py migrate satchmo_store.shop (--fake) > > > > 3) CHANGE of models.py > > > > 4) ./manage.py schemamigration satchmo_store.shop --auto > > > > 5) ./manage.py migrate satchmo_store.shop > > > > > > What app-models changed for Multi Currency?: > > > > ------------------------------------------- > > > > Satchmo-9.0.2-py2.6.egg/product/models.py > > > > Satchmo-9.0.2-py2.6.egg/satchmo_store.shop/models.py > > > > > > How I tried to do the migration?: > > > > -------------------------------- > > > > 1) ./manage.py schemamigration satchmo_store.shop --init > > > > 2) ./manage.py migrate satchmo_store.shop --fake > > > > > > [quite the same i did for Satchmo-9.0.2-py2.6.egg/product/ but let's > > > > concentrate on satchmo_store.shop only right now.] > > > > > > 3) > > > > NOW I replace the whole Satchmo-9.0.2-py2.6.egg library with my "NEW" > > > > Multi Currency Version of Satchmo. > > > > I removed the migrations folders in the "NEW" Version > > > > Satchmo-9.0.2-py2.6.egg/product/migrations and > > > > Satchmo-0.0.2-py2.6.egg/satchmo_store/shop/migrations > > > > and replaced it in the "NEW" Multi Currency Satchmo" Version with the > > > > migration folders from the "OLD" version, because the are up to date. > > > > > > so in short: I just changed my models. (3) > > > > > > 4) ./manage.py schemamigration satchmo_store.shop --auto > > > > > > The Problem/Error message: > > > > ------------------------- > > > > ...traceback... > > > > django.db.utils.DatabaseError: column shop_config.currency_id does not > > > > exist > > > > LINE 1: ..._country_only", "shop_config"."sales_country_id", > > > > "shop_conf... > > > > > > So he is complaining about that shop_config.currency_id does not exist. > > > > (which is a foreignkeyfield) Yeah, great. But this is the reason why I > > > > do a migration. It did not exist in the old version. But South should > > > > create it now. Its in the models. I already told you. When I do a fresh > > > > database setup with syncdb --all it works. > > > > > > I am really bad at migrations. What did I do wrong? > > > > Thank you so much for your help guys! > > > > ionic > -- You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en.
