diff options
author | Boris Pavlovic <boris@pavlovic.me> | 2013-02-04 17:34:55 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2013-02-07 15:25:29 -0500 |
commit | 1575b00bb383b35d0251a5f74e67c1b18d61e51d (patch) | |
tree | c4db321de31fa7c4f8b95f28a32ea4d79c535034 /tests/unit/db/sqlalchemy/test_sqlalchemy.py | |
parent | 4ce828dbb170390f01f2d931ff7a165aefe87c32 (diff) | |
download | oslo-1575b00bb383b35d0251a5f74e67c1b18d61e51d.tar.gz oslo-1575b00bb383b35d0251a5f74e67c1b18d61e51d.tar.xz oslo-1575b00bb383b35d0251a5f74e67c1b18d61e51d.zip |
Provide creating real unique constraints for columns
Main issue is that we can't create unique constraint for columns, because
we are using soft deletion of entries (set `deleted` column to True).
The main idea is to use `deleted` columns to create unique constraint for
columns. For example (`col1`, `deleted`).
To make (`col1`, `deleted`) unique after entry deletion, we should assign the
value of `id` to `deleted` column.
Change type of `deleted` column from Boolean to table.id.type for all tables.
Change models.soft_delete() method to assign table.id instead of True to
`deleted` column.
Change query.soft_delete() method to assign literal_column("id") instead of True
blueprint db-unique-keys
Change-Id: Ie1f67f49a5d085e6371efb63fc23a1c8b25d9464
Diffstat (limited to 'tests/unit/db/sqlalchemy/test_sqlalchemy.py')
0 files changed, 0 insertions, 0 deletions