Ticket #45 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

Invalid code generated by startmigration --initial

Reported by: eallik@… Owned by: andrew
Priority: major Milestone: 0.5
Component: commands Version: 0.4
Keywords: Cc:

Description

I get totally invalid Python code when using startmigration --initial

Attachments

models.py (11.1 KB) - added by eallik@… 6 years ago.
models.py
0001_initial.py (8.8 KB) - added by anonymous 6 years ago.
generated migration

Change History

Changed 6 years ago by eallik@…

models.py

Changed 6 years ago by anonymous

generated migration

comment:1 Changed 6 years ago by amccurdy

The problem is the code inspector can't figure out the definition for your Reservation model's end_datetime field. There's a big note in the migration file indicating this on line number 134.

For a quick fix, you can either copy the field definition of end_datetime to the migration.

The real reason this is broken is the way startmigration determines the field definition. If you moved your "make_reservation" function below the field definitions in the Reservation model, everything should work.

Obviously that's not an acceptable answer. It's not an easy problem to solve. We're working on trying to do that, but I wanted to provide you with as workaround until that happens.

comment:2 Changed 6 years ago by andrew

  • Status changed from new to accepted
  • Version changed from subversion to 0.4
  • Milestone set to The Future

This will be delayed until we fix #41 and #47 as well with a new models.py parser.

comment:3 Changed 5 years ago by andrew

  • Status changed from accepted to closed
  • Resolution set to fixed

This should be fixed as of the ORM Freezer checkin (committed in [140] - [143]). Your models.py file does now produce a valid migration here, so closing.

comment:4 Changed 5 years ago by andrew

  • Milestone changed from The Future to 0.5

Also remember to use startmigration2 until we rename it.

Note: See TracTickets for help on using tickets.