Commit d6355270 authored by Leo Gordon's avatar Leo Gordon
Browse files

schema change: turned all VARCHAR(<255) into VARCHAR(255) -- should improve...

schema change: turned all VARCHAR(<255) into VARCHAR(255) -- should improve experience with long host namest (thanks, MichaelP!)
parent a8e72f12
-- extend all VARCHAR fields to 255 (this will not affect neither storage nor performance) :
ALTER TABLE analysis_base MODIFY COLUMN logic_name VARCHAR(255) NOT NULL;
ALTER TABLE analysis_base MODIFY COLUMN meadow_type VARCHAR(255) DEFAULT NULL;
ALTER TABLE resource_class MODIFY COLUMN name VARCHAR(255) NOT NULL;
ALTER TABLE resource_description MODIFY COLUMN meadow_type VARCHAR(255) NOT NULL;
ALTER TABLE hive_meta MODIFY COLUMN meta_key VARCHAR(255) NOT NULL;
ALTER TABLE meta MODIFY COLUMN meta_key VARCHAR(255) NOT NULL;
ALTER TABLE worker MODIFY COLUMN meadow_type VARCHAR(255) NOT NULL;
ALTER TABLE worker MODIFY COLUMN meadow_name VARCHAR(255) NOT NULL;
ALTER TABLE worker MODIFY COLUMN host VARCHAR(255) NOT NULL;
ALTER TABLE worker MODIFY COLUMN process_id VARCHAR(255) NOT NULL;
-- UPDATE hive_sql_schema_version
UPDATE hive_meta SET meta_value=53 WHERE meta_key='hive_sql_schema_version' AND meta_value='52';
-- extend all VARCHAR fields to 255 (this will not affect neither storage nor performance) :
ALTER TABLE analysis_base ALTER COLUMN logic_name SET DATA TYPE VARCHAR(255);
ALTER TABLE analysis_base ALTER COLUMN meadow_type SET DATA TYPE VARCHAR(255);
ALTER TABLE resource_class ALTER COLUMN name SET DATA TYPE VARCHAR(255);
ALTER TABLE resource_description ALTER COLUMN meadow_type SET DATA TYPE VARCHAR(255);
ALTER TABLE hive_meta ALTER COLUMN meta_key SET DATA TYPE VARCHAR(255);
ALTER TABLE meta ALTER COLUMN meta_key SET DATA TYPE VARCHAR(255);
ALTER TABLE worker ALTER COLUMN meadow_type SET DATA TYPE VARCHAR(255);
ALTER TABLE worker ALTER COLUMN meadow_name SET DATA TYPE VARCHAR(255);
ALTER TABLE worker ALTER COLUMN host SET DATA TYPE VARCHAR(255);
ALTER TABLE worker ALTER COLUMN process_id SET DATA TYPE VARCHAR(255);
-- UPDATE hive_sql_schema_version
UPDATE hive_meta SET meta_value=53 WHERE meta_key='hive_sql_schema_version' AND meta_value='52';
-- extend all VARCHAR fields to 255
-- (since according to the manual SQLite does not impose any size restrictions on VARCHAR
-- there is actually nothing to patch except for the schema version)
-- UPDATE hive_sql_schema_version
UPDATE hive_meta SET meta_value=53 WHERE meta_key='hive_sql_schema_version' AND meta_value='52';
......@@ -40,7 +40,7 @@
CREATE TABLE analysis_base (
analysis_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
logic_name VARCHAR(40) NOT NULL,
logic_name VARCHAR(255) NOT NULL,
module VARCHAR(255),
parameters TEXT,
resource_class_id INTEGER NOT NULL,
......@@ -48,7 +48,7 @@ CREATE TABLE analysis_base (
max_retry_count INTEGER NOT NULL DEFAULT 3,
can_be_empty SMALLINT NOT NULL DEFAULT 0,
priority SMALLINT NOT NULL DEFAULT 0,
meadow_type VARCHAR(40) DEFAULT NULL,
meadow_type VARCHAR(255) DEFAULT NULL,
analysis_capacity INTEGER DEFAULT NULL,
UNIQUE KEY logic_name_idx (logic_name)
......@@ -201,8 +201,8 @@ CREATE TABLE analysis_ctrl_rule (
*/
CREATE TABLE resource_class (
resource_class_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(40) NOT NULL,
resource_class_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
UNIQUE KEY(name)
) COLLATE=latin1_swedish_ci ENGINE=InnoDB;
......@@ -221,8 +221,8 @@ CREATE TABLE resource_class (
*/
CREATE TABLE resource_description (
resource_class_id INTEGER NOT NULL,
meadow_type VARCHAR(40) NOT NULL,
resource_class_id INTEGER NOT NULL,
meadow_type VARCHAR(255) NOT NULL,
parameters VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY(resource_class_id, meadow_type)
......@@ -373,7 +373,7 @@ CREATE TABLE analysis_data (
*/
CREATE TABLE hive_meta (
meta_key VARCHAR(80) NOT NULL PRIMARY KEY,
meta_key VARCHAR(255) NOT NULL PRIMARY KEY,
meta_value TEXT
) COLLATE=latin1_swedish_ci ENGINE=MyISAM;
......@@ -398,10 +398,10 @@ CREATE TABLE hive_meta (
*/
CREATE TABLE IF NOT EXISTS meta (
meta_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
species_id INTEGER DEFAULT 1,
meta_key VARCHAR(40) NOT NULL,
meta_value TEXT NOT NULL,
meta_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
species_id INTEGER DEFAULT 1,
meta_key VARCHAR(255) NOT NULL,
meta_value TEXT NOT NULL,
UNIQUE KEY species_key_value_idx (species_id, meta_key, meta_value(255)),
KEY species_value_idx (species_id, meta_value(255))
......@@ -442,10 +442,10 @@ CREATE TABLE IF NOT EXISTS meta (
CREATE TABLE worker (
worker_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
meadow_type VARCHAR(40) NOT NULL,
meadow_name VARCHAR(40) NOT NULL,
host VARCHAR(40) NOT NULL,
process_id VARCHAR(40) NOT NULL,
meadow_type VARCHAR(255) NOT NULL,
meadow_name VARCHAR(255) NOT NULL,
host VARCHAR(255) NOT NULL,
process_id VARCHAR(255) NOT NULL,
resource_class_id INTEGER DEFAULT NULL,
analysis_id INTEGER DEFAULT NULL,
......
......@@ -41,7 +41,7 @@
CREATE TABLE analysis_base (
analysis_id SERIAL PRIMARY KEY,
logic_name VARCHAR(40) NOT NULL,
logic_name VARCHAR(255) NOT NULL,
module VARCHAR(255),
parameters TEXT,
resource_class_id INTEGER NOT NULL,
......@@ -49,7 +49,7 @@ CREATE TABLE analysis_base (
max_retry_count INTEGER NOT NULL DEFAULT 3,
can_be_empty SMALLINT NOT NULL DEFAULT 0,
priority SMALLINT NOT NULL DEFAULT 0,
meadow_type VARCHAR(40) DEFAULT NULL,
meadow_type VARCHAR(255) DEFAULT NULL,
analysis_capacity INTEGER DEFAULT NULL,
UNIQUE (logic_name)
......@@ -205,7 +205,7 @@ CREATE TABLE analysis_ctrl_rule (
CREATE TABLE resource_class (
resource_class_id SERIAL PRIMARY KEY,
name VARCHAR(40) NOT NULL,
name VARCHAR(255) NOT NULL,
UNIQUE (name)
);
......@@ -225,7 +225,7 @@ CREATE TABLE resource_class (
CREATE TABLE resource_description (
resource_class_id INTEGER NOT NULL,
meadow_type VARCHAR(40) NOT NULL,
meadow_type VARCHAR(255) NOT NULL,
parameters VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY(resource_class_id, meadow_type)
......@@ -377,7 +377,7 @@ CREATE INDEX ON analysis_data (data);
*/
CREATE TABLE hive_meta (
meta_key VARCHAR(80) NOT NULL PRIMARY KEY,
meta_key VARCHAR(255) NOT NULL PRIMARY KEY,
meta_value TEXT
);
......@@ -404,7 +404,7 @@ CREATE TABLE hive_meta (
CREATE TABLE IF NOT EXISTS meta (
meta_id SERIAL PRIMARY KEY,
species_id INTEGER DEFAULT 1,
meta_key VARCHAR(40) NOT NULL,
meta_key VARCHAR(255) NOT NULL,
meta_value TEXT NOT NULL,
UNIQUE (species_id, meta_key, meta_value)
......@@ -446,10 +446,10 @@ CREATE INDEX ON meta (species_id, meta_value);
CREATE TYPE worker_cod AS ENUM ('NO_ROLE', 'NO_WORK', 'JOB_LIMIT', 'HIVE_OVERLOAD', 'LIFESPAN', 'CONTAMINATED', 'KILLED_BY_USER', 'MEMLIMIT', 'RUNLIMIT', 'SEE_MSG', 'UNKNOWN');
CREATE TABLE worker (
worker_id SERIAL PRIMARY KEY,
meadow_type VARCHAR(40) NOT NULL,
meadow_name VARCHAR(40) NOT NULL,
host VARCHAR(40) NOT NULL,
process_id VARCHAR(40) NOT NULL,
meadow_type VARCHAR(255) NOT NULL,
meadow_name VARCHAR(255) NOT NULL,
host VARCHAR(255) NOT NULL,
process_id VARCHAR(255) NOT NULL,
resource_class_id INTEGER DEFAULT NULL,
analysis_id INTEGER DEFAULT NULL,
......
......@@ -40,7 +40,7 @@
CREATE TABLE analysis_base (
analysis_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
logic_name VARCHAR(40) NOT NULL,
logic_name VARCHAR(255) NOT NULL,
module VARCHAR(255),
parameters TEXT,
resource_class_id INTEGER NOT NULL,
......@@ -48,7 +48,7 @@ CREATE TABLE analysis_base (
max_retry_count INTEGER NOT NULL DEFAULT 3,
can_be_empty SMALLINT NOT NULL DEFAULT 0,
priority SMALLINT NOT NULL DEFAULT 0,
meadow_type VARCHAR(40) DEFAULT NULL,
meadow_type VARCHAR(255) DEFAULT NULL,
analysis_capacity INTEGER DEFAULT NULL
);
CREATE UNIQUE INDEX analysis_base_logic_name_idx ON analysis_base (logic_name);
......@@ -199,7 +199,7 @@ CREATE UNIQUE INDEX condition_ctrled_idx ON analysis_ctrl_rule (condition_analys
CREATE TABLE resource_class (
resource_class_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name VARCHAR(40) NOT NULL
name VARCHAR(255) NOT NULL
);
CREATE UNIQUE INDEX resource_class_name_idx ON resource_class (name);
......@@ -219,7 +219,7 @@ CREATE UNIQUE INDEX resource_class_name_idx ON resource_class (name);
CREATE TABLE resource_description (
resource_class_id INTEGER NOT NULL,
meadow_type VARCHAR(40) NOT NULL,
meadow_type VARCHAR(255) NOT NULL,
parameters VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY(resource_class_id, meadow_type)
......@@ -367,7 +367,7 @@ CREATE INDEX analysis_data_idx ON analysis_data (data);
*/
CREATE TABLE hive_meta (
meta_key VARCHAR(80) NOT NULL PRIMARY KEY,
meta_key VARCHAR(255) NOT NULL PRIMARY KEY,
meta_value TEXT
);
......@@ -394,7 +394,7 @@ CREATE TABLE hive_meta (
CREATE TABLE IF NOT EXISTS meta (
meta_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
species_id INTEGER DEFAULT 1,
meta_key VARCHAR(40) NOT NULL,
meta_key VARCHAR(255) NOT NULL,
meta_value TEXT NOT NULL
);
CREATE UNIQUE INDEX meta_species_key_value_idx ON meta (species_id, meta_key, meta_value);
......@@ -434,10 +434,10 @@ CREATE INDEX meta_species_value_idx ON meta (species_id, meta_value);
CREATE TABLE worker (
worker_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
meadow_type VARCHAR(40) NOT NULL,
meadow_name VARCHAR(40) NOT NULL,
host VARCHAR(40) NOT NULL,
process_id VARCHAR(40) NOT NULL,
meadow_type VARCHAR(255) NOT NULL,
meadow_name VARCHAR(255) NOT NULL,
host VARCHAR(255) NOT NULL,
process_id VARCHAR(255) NOT NULL,
resource_class_id INTEGER DEFAULT NULL,
analysis_id INTEGER DEFAULT NULL,
......
Markdown is supported
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