cinder/cinder/db/sqlalchemy/migrate_repo/versions/062_sqlite_upgrade.sql
Sheel Rana b2cd356cac Updated "deleted" column of volume_type_access
Below changes are done in this commit:

a. replaced update()
update() is replaced with oslo.db's soft_delete() used in
volume_type_access_remove() function of sqlalchemy.db.api to keep
value of "id" in "deleted" column during volume type access remove
operation.
This bug will be solved after this change.

b. updated db schema
db schema of volume_type_projects if updated.
As tinyint can store maximum 127, "deleted" column type is modified
tinyint->integer so that it can store more than 128 entries in it.

c. release notes
release notes added to prohibit addition or deletion of
volume_type_access to a project during update operation.

UpgradeImpact
Closes-Bug: #1518363

Change-Id: I638a202dfb2b4febf1d623683de22df3b6dc2615
2015-12-30 13:02:16 +00:00

30 lines
863 B
SQL

-- As sqlite does not support the DROP CHECK, we need to create
-- the table, and move all the data to it.
CREATE TABLE volume_type_projects_new (
created_at DATETIME,
updated_at DATETIME,
deleted_at DATETIME,
deleted INTEGER,
id INTEGER NOT NULL,
volume_type_id VARCHAR(36),
project_id VARCHAR(255),
PRIMARY KEY (id),
FOREIGN KEY (volume_type_id) REFERENCES volume_types(id),
CONSTRAINT uniq_volume_type_projects0volume_type_id0project_id0deleted UNIQUE (volume_type_id, project_id, deleted)
);
INSERT INTO volume_type_projects_new
SELECT created_at,
updated_at,
deleted_at,
deleted,
id,
volume_type_id,
project_id
FROM volume_type_projects;
DROP TABLE volume_type_projects;
ALTER TABLE volume_type_projects_new RENAME TO volume_type_projects;