SQLite doesn't provide a native implementation of BOOLEAN data type.
SQLAlchemy emulates BOOLEAN data type for SQLite using INT column +
a CHECK constraint.
We've been providing a helper util to change the type of column
'deleted' from BOOLEAN to INT. Due to limitations of ALTER in SQLite,
in order to do that, we omit the original 'deleted' column as well as
the corresponding CHECK constraint when recreating the table.
Omitting of the constraint is more tricky, though. It's implemented
by analyzing the SQL text used for its rendering. SQLAlchemy
versions 0.8.3+ slightly changed the way constraints are rendered, so
we have to update our util changing the type of 'deleted' column to
work with SQLAlchemy 0.8.3+ on SQLite backend (we aren't using SQLite
in production, but we still need it for running of unit tests).
Reviewed: https:/ /review. openstack. org/93414 /git.openstack. org/cgit/ openstack/ oslo.db/ commit/ ?id=528e406053a c9dfc5ee1348cf1 ee64220ad0c1ce
Committed: https:/
Submitter: Jenkins
Branch: master
commit 528e406053ac9df c5ee1348cf1ee64 220ad0c1ce
Author: Ilya Pekelny <email address hidden>
Date: Tue May 13 14:16:44 2014 +0300
Fix changing the type of column deleted
SQLite doesn't provide a native implementation of BOOLEAN data type.
SQLAlchemy emulates BOOLEAN data type for SQLite using INT column +
a CHECK constraint.
We've been providing a helper util to change the type of column
'deleted' from BOOLEAN to INT. Due to limitations of ALTER in SQLite,
in order to do that, we omit the original 'deleted' column as well as
the corresponding CHECK constraint when recreating the table.
Omitting of the constraint is more tricky, though. It's implemented
by analyzing the SQL text used for its rendering. SQLAlchemy
versions 0.8.3+ slightly changed the way constraints are rendered, so
we have to update our util changing the type of 'deleted' column to
work with SQLAlchemy 0.8.3+ on SQLite backend (we aren't using SQLite
in production, but we still need it for running of unit tests).
Closes-Bug: #1252693
Change-Id: Ie92caff0052172 50de17461f4f876 92ad8e96a09