EVOLUTION-MANAGER
Edit File: create_attr_legacy.test
--disable_warnings DROP TABLE IF EXISTS not_backing; DROP TABLE IF EXISTS backing; DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE `not_backing` ( id int(10) unsigned NOT NULL DEFAULT '0', info varchar(20) DEFAULT NULL, KEY name (info) ) DEFAULT CHARSET=latin1; CREATE TABLE backing ( id int(10) unsigned NOT NULL DEFAULT '0', nullparent int(10) unsigned DEFAULT NULL, parent int(10) unsigned DEFAULT 1 NOT NULL, weight real(10,4) NOT NULL DEFAULT 0.0, info varchar(20) DEFAULT NULL, not_id_type varchar(20) DEFAULT NULL, not_weight_type varchar(20) DEFAULT NULL, PRIMARY KEY (id), KEY name (info) ) DEFAULT CHARSET=latin1; # Here we enable scaffolding to let us create a deprecated table # so we can check that the new code will still allow queries to be performed # on a legacy database # It should still generate a warning (1287) - but I dont know how to test for that # # latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future # release. Please use 'latch VARCHAR(32) NULL' instead # SET GLOBAL oqgraph_allow_create_integer_latch=true; --echo The next warnings 1287 are expected # oqgraph v2 create table should fail (missing attributes) CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH; --error 1296 DESCRIBE oqtable; # attributes test # empty table reference --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE=''; --error 1296 DESCRIBE oqtable; # non-existent table reference --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='bogus'; --error 1296 DESCRIBE oqtable; # UTF in table name, make sure it doesnt crash --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='Ω Ohms Tennis Ball 〄'; --error 1296 DESCRIBE oqtable; # Invalid backing table (backing table has no primary key) --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing', ORIGID='id'; --error 1296 DESCRIBE oqtable; # table with empty origid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID=''; --error 1296 DESCRIBE oqtable; # invalid origid reference --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus'; --error 1296 DESCRIBE oqtable; # wrong type origid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type'; --error 1296 DESCRIBE oqtable; # missing destid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id'; --error 1296 DESCRIBE oqtable; # empty destid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID=''; --error 1296 DESCRIBE oqtable; # invalid destid reference --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='bogus'; --error 1296 DESCRIBE oqtable; # wrong type destid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='not_id_type'; --error 1296 DESCRIBE oqtable; # invalid origid with valid destid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus',DESTID='id'; --error 1296 DESCRIBE oqtable; # wrong type origid with valid destid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type',DESTID='id'; --error 1296 DESCRIBE oqtable; # same origid and destid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id'; --error 1296 DESCRIBE oqtable; # invalid weight reference --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='bogus'; --error 1296 DESCRIBE oqtable; # wrong type weight --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='not_weight_type'; --error 1296 DESCRIBE oqtable; # NULLABLE ORIGID --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='nullparent',DESTID='id',WEIGHT='weight'; --error 1296 DESCRIBE oqtable; # NULLABLE DESTID --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='nullparent',WEIGHT='weight'; --error 1296 DESCRIBE oqtable; # all valid --disable_warnings DROP TABLE IF EXISTS oqtable; --enable_warnings CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='weight'; DESCRIBE oqtable; # cleanup --disable_warnings DROP TABLE IF EXISTS oqtable; DROP TABLE IF EXISTS backing; DROP TABLE IF EXISTS not_backing; --enable_warnings SET GLOBAL oqgraph_allow_create_integer_latch=false;