lfs_migrate detecting bad version

86 views
Skip to first unread message

Martin Tiršel

unread,
May 16, 2012, 4:59:26 PM5/16/12
to djang...@googlegroups.com
Hi,

is it bug or I have done something wrong? I had version 0.6.x, some days ago I upgraded to version 0.7.2 but the migration failed, so I destroyed the database and made empty database and lfs_init. Today I upgraded from 0.7.2 to 0.7.3, ran lfs_migrate and got:

Detected version: 0.5
Migrating to 0.6
Traceback (most recent call last):
File "../manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/lfs/core/management/commands/lfs_migrate.py", line 36, in handle
self.migrate_to_06(application, version)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/lfs/core/management/commands/lfs_migrate.py", line 146, in migrate_to_06
db.add_column("voucher_voucher", "used_amount", models.PositiveSmallIntegerField(default=0))
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/south/db/generic.py", line 282, in add_column
self.execute(sql)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/south/db/generic.py", line 150, in execute
cursor.execute(sql, params)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 114, in execute
return self.cursor.execute(query, args)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/home/bruce/.virtualenv/lfs/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.DatabaseError: (1060, "Duplicate column name 'used_amount'")

I am using virtualenv, package was upgraded with pip.

Second thing, I can not uncheck Active base price in product data. After unchecking and saving I have the box checked again.


Thanks,
Martin

Kai Diefenbach

unread,
May 16, 2012, 5:26:12 PM5/16/12
to django-lfs
Hi Martin,

On 16 Mai, 22:59, Martin Tiršel <konf...@blackpage.eu> wrote:
> is it bug or I have done something wrong? I had version 0.6.x, some days
> ago I upgraded to version 0.7.2 but the migration failed, so I destroyed
> the database and made empty database and lfs_init. Today I upgraded from
> 0.7.2 to 0.7.3, ran lfs_migrate and got:

First of all, you don't need to migrate from 0.7.2 to 0.7.3. If you
ran the installation from 0.7.2 properly:

http://docs.getlfs.com/en/latest/introduction/installation.html#id1

and then execute lfs_migrate on 0.7.3 you should get:

$ bin/django lfs_migrate
Detected version: 0.7
You are up-to-date

I've just tried it here and it works. I assume you haven't run
lfs_init on 0.7.2.

> Second thing, I can not uncheck Active base price in product data. After
> unchecking and saving I have the box checked again.

Thanks for reporting this. It is already fixed within the repository,
see:

https://github.com/diefenbach/django-lfs/commit/18cb4918ee881b852f8c0d3e8d7cdebb00cb7c30

This will be part of the next release, presumably the at upcoming
weekend.

Regards
Kai

Martin Tiršel

unread,
May 22, 2012, 4:52:11 PM5/22/12
to djang...@googlegroups.com
Hi,

thanks I tried to migrate production server with the same code and I got still some errors. I had working 0.6 version with some setup and tried now to migrate to 0.7:

* upgraded python packages with pip command (lfs to 0.6.x -> 0.7.4, django 1.3->1.4, ...)
* ran ../manage.py syncdb:

Syncing...
Creating tables ...
Creating table south_migrationhistory
Creating table catalog_productattachment
Creating table portlet_forsaleportlet
Creating table portlet_featuredportlet
Creating table customer_tax_customertax_countries
Creating table customer_tax_customertax
Creating table lfs_order_numbers_ordernumbergenerator
The following content types are stale and need to be deleted:

auth | message

Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.

Type 'yes' to continue, or 'no' to cancel: yes
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

Synced:
> predajsperkov.sitetheme
> compressor
> django.contrib.admin
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.staticfiles
> django.contrib.sites
> django.contrib.flatpages
> django.contrib.redirects
> django.contrib.sitemaps
> djangorestframework
> django_countries
> south
> debug_toolbar
> pagination
> reviews
> sorl.thumbnail
> tagging
> portlets
> lfs.core
> lfs.cart
> lfs.catalog
> lfs.checkout
> lfs.criteria
> lfs.customer
> lfs.discounts
> lfs.export
> lfs.gross_price
> lfs.integrationtests
> lfs.marketing
> lfs.manufacturer
> lfs.net_price
> lfs.order
> lfs.page
> lfs.payment
> lfs.portlet
> lfs.search
> lfs.shipping
> lfs.supplier
> lfs.tax
> lfs.customer_tax
> lfs.voucher
> lfs_order_numbers
> postal

Not synced (use migrations):
- paypal.standard.ipn
- paypal.standard.pdt



* lfs_migrate:

../manage.py lfs_migrate
Detected version: 0.6

Traceback (most recent call last):
File "../manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/lfs/core/management/commands/lfs_migrate.py", line 40, in handle
self.migrate_to_07(application, version)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/lfs/core/management/commands/lfs_migrate.py", line 58, in migrate_to_07
db.add_column("catalog_product", "type_of_quantity_field", models.PositiveSmallIntegerField(_(u"Type of quantity field"), null=True, blank=True, choices=QUANTITY_FIELD_TYPES))
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/south/db/generic.py", line 282, in add_column
self.execute(sql)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/south/db/generic.py", line 150, in execute
cursor.execute(sql, params)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 114, in execute
return self.cursor.execute(query, args)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/var/www/.virtualenv/lfs/lib/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.DatabaseError: (1060, "Duplicate column name 'type_of_quantity_field'")

Thanks,
Martin

Kai Diefenbach

unread,
May 23, 2012, 3:17:44 AM5/23/12
to djang...@googlegroups.com
Hi, 

"type_of_quantity_field" doesn't exist within 0.6 (you might check the DB before executing lfs_migrate) and is supposed to be added only once within the migration to 0.7.

It's working here. So I have no idea what's going wrong there.

Kai

Martin Tiršel

unread,
May 23, 2012, 5:40:42 PM5/23/12
to djang...@googlegroups.com
I see that I had version 0.5 in Application model record but I never installed version 0.5. I created pure virtualenv, installed version 0.7.4 and ran lfs_init on empty database... So I realy don't know how it was written there. I changed it manually to 0.7

But now I have one more problem. I installed 0.7.4 with pip install django-lfs==0.7.4 and this version seems not to be the same as on lfs demo page. There the Active base price is working (I can uncheck it) but on my local installation I have still the problem with unchecking the active base price (the item is unchecked but everytime I load the product data page, it gets checked and save causes base price to be active unles i uncheck it before saving). Is the demo running version 0.7.4? I created new virtualenv to be sure there is pure lfs installation of version 0.7.4.

Thanks,
Martin

Kai Diefenbach

unread,
May 24, 2012, 4:44:59 AM5/24/12
to djang...@googlegroups.com
Hi, 

Am 23.05.2012 um 23:40 schrieb Martin Tiršel:

But now I have one more problem. I installed 0.7.4 with pip install django-lfs==0.7.4 and this version seems not to be the same as on lfs demo page. There the Active base price is working (I can uncheck it) but on my local installation I have still the problem with unchecking the active base price (the item is unchecked but everytime I load the product data page, it gets checked and save causes base price to be active unles i uncheck it before saving). Is the demo running version 0.7.4? I created new virtualenv to be sure there is pure lfs installation of version 0.7.4.

0.7.x needs Django 1.3.x. In Django 1.3.x this problem shouldn't exist.


Kai

--
IQ++
Tel: +49 361 / 6636700
Fax: +49 361 / 6636702
Mail: kai.die...@iqpp.de
Web: http://www.iqpp.de
Skype: kai.diefenbach

Reply all
Reply to author
Forward
0 new messages