[7e8132af] | 1 | ### Database update file. |
---|
[2b15bdb] | 2 | # OpenGnsys 1.1.1, 1.1.1a, 1.1.1b, 1.1.1c - OpenGnsys 1.2.0 |
---|
| 3 | #use ogAdmBD |
---|
| 4 | |
---|
| 5 | DROP PROCEDURE IF EXISTS altercols; |
---|
[7e8132af] | 6 | # Procedure to perform conditional table update. |
---|
[2b15bdb] | 7 | DELIMITER '//' |
---|
| 8 | CREATE PROCEDURE altercols() BEGIN |
---|
[7e8132af] | 9 | # Add row and column fields to locate computer in the lab (ticket #944). |
---|
[2b15bdb] | 10 | IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS |
---|
| 11 | WHERE COLUMN_NAME='n_row' AND TABLE_NAME='ordenadores' AND TABLE_SCHEMA=DATABASE()) |
---|
| 12 | THEN |
---|
| 13 | ALTER TABLE ordenadores |
---|
| 14 | ADD n_row SMALLINT NOT NULL DEFAULT 0, |
---|
| 15 | ADD n_col SMALLINT NOT NULL DEFAULT 0; |
---|
| 16 | END IF; |
---|
[7e8132af] | 17 | # Add maintenance and remote access fields for computers (tickets #991 y #992). |
---|
[2b15bdb] | 18 | IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS |
---|
| 19 | WHERE COLUMN_NAME='inremotepc' AND TABLE_NAME='ordenadores' AND TABLE_SCHEMA=DATABASE()) |
---|
| 20 | THEN |
---|
| 21 | ALTER TABLE ordenadores |
---|
| 22 | ADD inremotepc SMALLINT NOT NULL DEFAULT 0, |
---|
| 23 | ADD maintenance SMALLINT NOT NULL DEFAULT 0; |
---|
| 24 | END IF; |
---|
[7e8132af] | 25 | # Add URL to release a reserved computer for remote access (ticket #992). |
---|
[c607df7] | 26 | IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS |
---|
| 27 | WHERE COLUMN_NAME='urlrelease' AND TABLE_NAME='remotepc' AND TABLE_SCHEMA=DATABASE()) |
---|
| 28 | THEN |
---|
| 29 | ALTER TABLE remotepc |
---|
[7e8132af] | 30 | ADD urlrelease VARCHAR(100) DEFAULT NULL AFTER urllogout; |
---|
[c607df7] | 31 | END IF; |
---|
[7e8132af] | 32 | # Add flag field to indicate if a local session is open (ticket #992). |
---|
| 33 | IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS |
---|
| 34 | WHERE COLUMN_NAME='islocal' AND TABLE_NAME='remotepc' AND TABLE_SCHEMA=DATABASE()) |
---|
| 35 | THEN |
---|
| 36 | ALTER TABLE remotepc |
---|
| 37 | ADD islocal TINYINT NOT NULL DEFAULT 0; |
---|
| 38 | END IF; |
---|
| 39 | # |
---|
[ad61ab7] | 40 | IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS |
---|
| 41 | WHERE COLUMN_NAME='clonator' AND TABLE_NAME='imagenes' AND TABLE_SCHEMA=DATABASE()) |
---|
| 42 | THEN |
---|
| 43 | ALTER TABLE imagenes |
---|
| 44 | ADD clonator varchar(100) NOT NULL DEFAULT '', |
---|
| 45 | ADD compressor varchar(100) NOT NULL DEFAULT '', |
---|
| 46 | ADD filesystem varchar(100) NOT NULL DEFAULT '', |
---|
| 47 | ADD datasize bigint NOT NULL DEFAULT 0; |
---|
| 48 | END IF; |
---|
[2b15bdb] | 49 | END// |
---|
[7e8132af] | 50 | # Run conditional update. |
---|
[2b15bdb] | 51 | DELIMITER ';' |
---|
| 52 | CALL altercols(); |
---|
| 53 | DROP PROCEDURE altercols; |
---|
| 54 | |
---|
[7e8132af] | 55 | # Redefine some fields as not null. |
---|
[2b15bdb] | 56 | ALTER TABLE aulas |
---|
| 57 | MODIFY inremotepc SMALLINT NOT NULL DEFAULT 0; |
---|
| 58 | ALTER TABLE imagenes |
---|
| 59 | MODIFY inremotepc SMALLINT NOT NULL DEFAULT 0; |
---|
[7e8132af] | 60 | # Redefine some fields as null by default. |
---|
[c607df7] | 61 | ALTER TABLE remotepc |
---|
| 62 | MODIFY urllogin VARCHAR(100) DEFAULT NULL, |
---|
| 63 | MODIFY urllogout VARCHAR(100) DEFAULT NULL; |
---|