Tables are generated outside of migration process

Bug #824794 reported by Rick Harris
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Jay Pipes

Bug Description

Currently SQLALchemy is 'nice' enough to create tables for us if they are not present. In theory this would be great, except that it messes up our migrations.

The reason is, when SQLAlchemy autogenerates the tables, it doesn't include a schema_version...so, when someone subsequently run db_sync it attempts to create the tables that are already there.

The solution here is probably to disable the autocreation of tables.

Revision history for this message
Jay Pipes (jaypipes) wrote :

I think the solution here is not to disable the autocreation of tables but instead to put a try: except block around the code in db_sync in nova-manage that catches the predictable table already exists error, and simply sets the the schema_version record to the last DB version in the migrate_repo... I'll have a stab at this.

Changed in glance:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Jay Pipes (jaypipes)
milestone: none → essex-1
Jay Pipes (jaypipes)
Changed in glance:
status: Triaged → In Progress
Jay Pipes (jaypipes)
Changed in glance:
milestone: essex-1 → essex-2
Thierry Carrez (ttx)
Changed in glance:
milestone: essex-2 → essex-3
Jay Pipes (jaypipes)
Changed in glance:
milestone: essex-3 → essex-4
Revision history for this message
Jay Pipes (jaypipes) wrote :

I'd love to see migrations standardized and cleaned up across most core projects, actually ... I'm not getting anywhere with this branch and am going to push it off until Folsom I think...

Changed in glance:
milestone: essex-4 → none
status: In Progress → Confirmed
Revision history for this message
Bernhard M. Wiedemann (ubuntubmw) wrote :

I tried to reproduce this issue, but it just worked here for sqlite, mysql and postgresql.
While starting glance before db_sync did create tables without version, a subsequent db_sync returned without error and did add the version to the DB.

Revision history for this message
Mark McLoughlin (markmc) wrote :

rc3 glance automatically version controls auto-created DBs. See bug #966241

Revision history for this message
Jay Pipes (jaypipes) wrote :

OK, I'm going to mark this bug Fix Released, then...

Changed in glance:
status: Confirmed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: none → 2012.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.