SQL scripts should not manage transactions

Cinder SQL scripts assume too much about the environment and the way in
which they are executed by sqlalchemy-migrate. Particularly, they manage
transactions on their own even though sqlalchemy-migrate do it itself,
plus it assumes that scripts are executed in one go (even though
standard Python DB-API 2.0 does not mention multi-statement SQL commands
to be executed on DB cursors.

blueprint enable-mysql-connector

Change-Id: I10c58b3af75d3ab9153a8bbd2a539bf1577de328
Closes-Bug: 1368391
This commit is contained in:
Ihar Hrachyshka 2014-09-12 10:57:34 +02:00
parent 69b4cfd09c
commit 675e0e5889
6 changed files with 0 additions and 19 deletions

@ -1,5 +1,3 @@
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE volumes_backup (
created_at DATETIME,
updated_at DATETIME,
@ -121,4 +119,3 @@ INSERT INTO volumes
FROM volumes_backup;
DROP TABLE volumes_backup;
COMMIT;

@ -1,8 +1,6 @@
-- As sqlite does not support the DROP FOREIGN KEY, we need to create
-- the table, and move all the data to it.
BEGIN TRANSACTION;
CREATE TABLE snapshots_v6 (
created_at DATETIME,
updated_at DATETIME,
@ -28,5 +26,3 @@ INSERT INTO snapshots_v6 SELECT * FROM snapshots;
DROP TABLE snapshots;
ALTER TABLE snapshots_v6 RENAME TO snapshots;
COMMIT;

@ -1,5 +1,3 @@
BEGIN TRANSACTION;
CREATE TABLE volumes_v10 (
created_at DATETIME,
updated_at DATETIME,
@ -61,4 +59,3 @@ INSERT INTO volumes_v10
DROP TABLE volumes;
ALTER TABLE volumes_v10 RENAME TO volumes;
COMMIT;

@ -1,5 +1,3 @@
BEGIN TRANSACTION;
CREATE TABLE volumes_v11 (
created_at DATETIME,
updated_at DATETIME,
@ -63,4 +61,3 @@ INSERT INTO volumes_v11
DROP TABLE volumes;
ALTER TABLE volumes_v11 RENAME TO volumes;
COMMIT;

@ -1,5 +1,3 @@
BEGIN TRANSACTION;
CREATE TABLE volumes_v12 (
created_at DATETIME,
updated_at DATETIME,
@ -65,4 +63,3 @@ INSERT INTO volumes_v12
DROP TABLE volumes;
ALTER TABLE volumes_v12 RENAME TO volumes;
COMMIT;

@ -1,5 +1,3 @@
BEGIN TRANSACTION;
CREATE TABLE volumes_v13 (
created_at DATETIME,
updated_at DATETIME,
@ -67,4 +65,3 @@ INSERT INTO volumes_v13
DROP TABLE volumes;
ALTER TABLE volumes_v13 RENAME TO volumes;
COMMIT;