Skip to content

Instantly share code, notes, and snippets.

@Naios
Last active August 29, 2015 14:16
Show Gist options
  • Save Naios/6505a139dcb70d5f6f5e to your computer and use it in GitHub Desktop.
Save Naios/6505a139dcb70d5f6f5e to your computer and use it in GitHub Desktop.
-- Updates base tables
-- 2015_03_11_00_world.sql
DROP TABLE IF EXISTS `updates`;
CREATE TABLE `updates` (
`name` VARCHAR(200) NOT NULL COMMENT 'filename with extension of the update.',
`hash` CHAR(40) NULL DEFAULT '' COMMENT 'sha1 hash of the sql file.',
`state` ENUM('RELEASED','ARCHIVED') NOT NULL DEFAULT 'RELEASED' COMMENT 'defines if an update is released or archived.',
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'timestamp when the query was applied.',
`speed` INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'time the query takes to apply in ms.',
PRIMARY KEY (`name`)
)
COMMENT='List of all applied updates in this database.'
COLLATE='utf8_general_ci'
ENGINE=MyISAM;
DROP TABLE IF EXISTS `updates_include`;
CREATE TABLE `updates_include` (
`path` VARCHAR(200) NOT NULL COMMENT 'directory to include. $ means relative to the source directory.',
`state` ENUM('RELEASED','ARCHIVED') NOT NULL DEFAULT 'RELEASED' COMMENT 'defines if the directory contains released or archived updates.',
PRIMARY KEY (`path`)
)
COMMENT='List of directories where we want to include sql updates.'
COLLATE='utf8_general_ci'
ENGINE=MyISAM;
-- World database update data
-- 2015_03_11_01_world.sql
TRUNCATE TABLE `updates_include`;
INSERT INTO `updates_include` (`path`, `state`) VALUES
('$/sql/updates/world', 'RELEASED'),
('$/sql/custom/world', 'RELEASED'),
('$/sql/old/6.x/world', 'ARCHIVED');
INSERT IGNORE INTO `updates` (`name`, `hash`) VALUES
('2015_03_11_00_world.sql', 'B761760804EA73BD297F296C5C1919687DF7191C'),
('2015_03_11_01_world.sql', '8481BE9B805704C97D2D8D54272F1E443184B3B2');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment