From b2c85d4198955798c2947e2698fb776039d9fe11 Mon Sep 17 00:00:00 2001 From: INOPIAE Date: Sun, 20 Jan 2013 10:24:19 +0100 Subject: [PATCH] bug 1139: Create script for database update --- database/update1.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 database/update1.sql diff --git a/database/update1.sql b/database/update1.sql new file mode 100644 index 0000000..1352b6f --- /dev/null +++ b/database/update1.sql @@ -0,0 +1,17 @@ +--- create new table to record the database version + CREATE TABLE IF NOT EXISTS `schema_version` ( + `id` int(11) PRIMARY KEY auto_increment, + `version` int(11) NOT NULL UNIQUE, + `when` datetime NOT NULL + ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci + +--- alter learnprogress by one column + ALTER TABLE `learnprogress` ADD `passed` int(11) NOT NULL DEFAULT '0'; + +--- update new column passed with -1 + UPDATE `learnprogress` SET `passed`=-1 + +--- update schema version number + INSERT INTO `schema_version` + (`version`, `when`) VALUES + ('1' , NOW() ); \ No newline at end of file