Commit 0842eef5 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[migration] Corrected problems on the migration scripts

- BlockId and CopyNb were swapped when superseded files moved to the
  recycle bin
- If a tape is disabled without any user comment, an default comment is
  set
parent 7b37a945
......@@ -68,8 +68,8 @@ INSERT INTO FILE_RECYCLE_LOG (
FILE_RECYCLE_LOG_ID,
VID,
FSEQ,
COPY_NB,
BLOCK_ID,
COPY_NB,
TAPE_FILE_CREATION_TIME,
ARCHIVE_FILE_ID,
DISK_INSTANCE_NAME,
......@@ -211,10 +211,10 @@ WHERE TAPE.IS_DISABLED = '0' AND (TAPE.TAPE_STATE IS NULL OR TAPE.TAPE_STATE <>
--precondition-sql-check expectedResult:"1" SELECT COUNT(*) FROM CTA_CATALOGUE WHERE SCHEMA_VERSION_MAJOR = 3 AND (SCHEMA_VERSION_MINOR = 1 OR SCHEMA_VERSION_MINOR = 2);
UPDATE TAPE
SET TAPE_STATE='DISABLED',
STATE_REASON=TAPE.USER_COMMENT,
STATE_REASON=(CASE WHEN TAPE.USER_COMMENT IS NULL THEN 'Migration from CTA 3.1 to 4.0: tape disabled without comment' ELSE TAPE.USER_COMMENT END),
STATE_UPDATE_TIME=(cast (systimestamp at time zone 'UTC' as date) - date '1970-01-01') * 86400,
STATE_MODIFIED_BY='Migration from CTA 3.1 to 4.0'
WHERE TAPE.IS_DISABLED = '1' AND (TAPE.TAPE_STATE IS NULL OR TAPE.TAPE_STATE != 'DISABLED') AND TAPE.USER_COMMENT NOT LIKE '%- BROKEN -%';
WHERE TAPE.IS_DISABLED = '1' AND (TAPE.TAPE_STATE IS NULL OR TAPE.TAPE_STATE != 'DISABLED') AND (TAPE.USER_COMMENT IS NULL OR TAPE.USER_COMMENT NOT LIKE '%- BROKEN -%');
--changeset ccaffy:15 failOnError:true dbms:oracle runAlways:true
--preconditions onFail:HALT onError:HALT
......@@ -250,12 +250,22 @@ ALTER TABLE VIRTUAL_ORGANIZATION ADD (
WRITE_MAX_DRIVES NUMERIC(20,0)
);
--changeset ccaffy:20 failOnError:true dbms:oracle
--changeset ccaffy:20 failOnError:true dbms:oracle runAlways:true
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"1" SELECT COUNT(*) FROM CTA_CATALOGUE WHERE SCHEMA_VERSION_MAJOR = 3 AND (SCHEMA_VERSION_MINOR = 1 OR SCHEMA_VERSION_MINOR = 2);
UPDATE VIRTUAL_ORGANIZATION SET READ_MAX_DRIVES=2 WHERE READ_MAX_DRIVES IS NULL;
--changeset ccaffy:21 failOnError:true dbms:oracle runAlways:true
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"1" SELECT COUNT(*) FROM CTA_CATALOGUE WHERE SCHEMA_VERSION_MAJOR = 3 AND (SCHEMA_VERSION_MINOR = 1 OR SCHEMA_VERSION_MINOR = 2);
UPDATE VIRTUAL_ORGANIZATION SET WRITE_MAX_DRIVES=2 WHERE WRITE_MAX_DRIVES IS NULL;
--changeset ccaffy:22 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.1" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
ALTER TABLE MOUNT_POLICY DROP CONSTRAINT MOUNT_POLICY_MDA_NN;
--changeset ccaffy:21 failOnError:true dbms:oracle
--changeset ccaffy:23 failOnError:true dbms:oracle
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"3.1" SELECT CONCAT(CONCAT(CAST(SCHEMA_VERSION_MAJOR as VARCHAR(10)),'.'), CAST(SCHEMA_VERSION_MINOR AS VARCHAR(10))) AS CATALOGUE_VERSION FROM CTA_CATALOGUE;
UPDATE CTA_CATALOGUE SET STATUS='PRODUCTION';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment