postgresql - Django migration having no effect, on postgres table -
when laying out tables ever reason used positiveintegerfield price. i've changed decimalfield makes more sense.
the migration worked locally (sqlite) , appears have succeeded on dev server. however, migration had no effect on postgres dev server.
here's output migration command.
djanog_settings_module=runner.dev_settings ./manage.py migrate operations perform: apply migrations: userprofiles, sessions, admin, sites, auth, contenttypes, inventory running migrations: applying inventory.0004_auto_20150613_1446... ok
after migration here's schema in pgsql.
table "public.inventory_baseitem" column | type | modifiers -----------------+------------------------+----------------------------------------------------------------- id | integer | not null default nextval('inventory_baseitem_id_seq'::regclass) title | character varying(100) | not null price | integer | not null units | integer | not null weight_lbs | integer | not null weight_ozs | integer | not null content_type_id | integer | not null ...
as can see price column's type still integer. frustratingly if re-run migration django says there no migrations apply.
while not production environment, if worst comes worst can manual alter table. doing defeats purpose of having django migrations.
per feedback, django version 1.7. migration follows:
class migration(migrations.migration): dependencies = [ ('inventory', '0003_auto_20150613_1439'), ] operations = [ migrations.alterfield( model_name='baseitem', name='price', field=models.decimalfield(default=0, max_digits=20, decimal_places=2), ), ]
i try upgrading django version doesn't come many breaking changes.
Comments
Post a Comment