Monkey patch SQLAlchemy-migrate to fix bugs with uniue constraints

Registered by Roman Podoliaka on 2013-07-03

Most of OpenStack projects use SQLAlchemy-migrate library for applying of DB schema migrations.

The library contains a few bugs related to handling of unique constraints in SQLite:
1. Adding a new unique constraint to a table deletes all existing ones.
2. Dropping of unique constrains is not supported at all (due to limited support of ALTER in SQLite).

Of course, we don't use SQLite in production and are interested in applying of DB schema migrations mainly on MySQL and PostgreSQL. Nevertheless, support of migrations on SQLite is vital for running unit tests in Nova (they are used to obtain an initial DB schema to run tests on; this can not be done by using of model descriptions as they are incomplete) and other projects using common Oslo DB code.

Unfortunately, SQLAlchemy-migrate seems to be a dead project, so these bugs can not be fixed in upstream code.

The other way to fix those is to monkey patch the library. Oslo seems to be a proper place to contain this patch, as it can be reused by other OpenStack projects, that rely on SQLAlchemy-migrate to make DB schema migrations.

Long term goal is to put this code into Alembic (currently, it doesn't support ALTER in SQLite on purpose, but pull requests are welcome) and migrate OpenStack projects to it.

Blueprint information

Status:
Complete
Approver:
Mark McLoughlin
Priority:
Medium
Drafter:
Roman Podoliaka
Direction:
Needs approval
Assignee:
Roman Podoliaka
Definition:
Approved
Series goal:
Accepted for havana
Implementation:
Implemented
Milestone target:
milestone icon 2013.2
Started by
Mark McLoughlin on 2013-07-06
Completed by
Roman Podoliaka on 2013-07-11

Related branches

Sprints

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.