my ($db, $table, $tsdb_compression) = @ARGV;
my @dbs = ('mysql', 'oracle', 'postgresql', 'timescaledb');
my @tables = ('history', 'history_uint', 'history_str', 'history_log', 'history_text');
my @tables_tsdb = ('history', 'history_uint', 'history_str', 'history_log', 'history_text', 'trends');
'alter_table' => 'RENAME TABLE %TBL TO %TBL_old;',
'create_table_begin' => 'CREATE TABLE `%TBL` (',
'create_table_end' => ') ENGINE=InnoDB;',
'pk_constraint' => "\t" . 'PRIMARY KEY (itemid,clock,ns)',
`itemid` bigint unsigned NOT NULL,
`clock` integer DEFAULT '0' NOT NULL,
`value` DOUBLE PRECISION DEFAULT '0.0000' NOT NULL,
`ns` integer DEFAULT '0' NOT NULL,
, 'history_uint' => <<'HEREDOC'
`itemid` bigint unsigned NOT NULL,
`clock` integer DEFAULT '0' NOT NULL,
`value` bigint unsigned DEFAULT '0' NOT NULL,
`ns` integer DEFAULT '0' NOT NULL,
, 'history_str' => <<'HEREDOC'
`itemid` bigint unsigned NOT NULL,
`clock` integer DEFAULT '0' NOT NULL,
`value` varchar(255) DEFAULT '' NOT NULL,
`ns` integer DEFAULT '0' NOT NULL,
, 'history_log' => <<'HEREDOC'
`itemid` bigint unsigned NOT NULL,
`clock` integer DEFAULT '0' NOT NULL,
`timestamp` integer DEFAULT '0' NOT NULL,
`source` varchar(64) DEFAULT '' NOT NULL,
`severity` integer DEFAULT '0' NOT NULL,
`logeventid` integer DEFAULT '0' NOT NULL,
`ns` integer DEFAULT '0' NOT NULL,
, 'history_text' => <<'HEREDOC'
`itemid` bigint unsigned NOT NULL,
`clock` integer DEFAULT '0' NOT NULL,
`ns` integer DEFAULT '0' NOT NULL,
'alter_table' => 'RENAME %TBL TO %TBL_old;',
'create_table_begin' => 'CREATE TABLE %TBL (',
'create_table_end' => ');',
'pk_constraint' => "\t" . 'CONSTRAINT PK_%UTBL PRIMARY KEY (itemid,clock,ns)',
itemid number(20) NOT NULL,
clock number(10) DEFAULT '0' NOT NULL,
value BINARY_DOUBLE DEFAULT '0.0000' NOT NULL,
ns number(10) DEFAULT '0' NOT NULL,