Skip to content

Commit

Permalink
Fix migrations rollback commands and comment migrations [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
ginatrapani committed Sep 7, 2012
1 parent fa314d7 commit 9c24ced
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 33 deletions.
2 changes: 1 addition & 1 deletion webapp/install/sql/build-db_mysql.sql
Expand Up @@ -517,7 +517,7 @@ CREATE TABLE tu_users (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Service user details.';


-- Dump completed on 2012-09-06 10:09:59
-- Dump completed on 2012-09-06 22:35:57

--
-- Insert DB Version
Expand Down
@@ -1 +1,4 @@
ALTER TABLE tu_insights CHANGE `text` text TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'Text content of the alert.';
--
-- Widen text field to accommadate longer insights.
--
ALTER TABLE tu_insights CHANGE `text` text TEXT NOT NULL COMMENT 'Text content of the alert.';
@@ -1,3 +1,6 @@
--
-- Create baselines table for comparative insights.
--
CREATE TABLE IF NOT EXISTS tu_insight_baselines (
date date NOT NULL COMMENT 'Date of baseline statistic.',
instance_id int(11) NOT NULL COMMENT 'Instance ID.',
Expand Down
@@ -1 +1,4 @@
--
-- Add insight prefix field for label/badge text in display.
--
ALTER TABLE tu_insights ADD `prefix` VARCHAR( 255 ) NOT NULL COMMENT 'Prefix to the text content of the alert.' AFTER slug;
@@ -1,3 +1,10 @@
--
-- Add icon and map_image support to places table.
--
ALTER TABLE tu_places ADD icon VARCHAR ( 255 ) COMMENT 'URL to an icon which represents the place type.';
ALTER TABLE tu_places ADD map_image VARCHAR( 255 ) COMMENT 'URL to an image of a map representing the area this place is in.';

--
-- Add marker for whether or not a post archive has been loaded during a crawl.
--
ALTER TABLE tu_instances ADD is_archive_loaded_posts INT( 1 ) NOT NULL DEFAULT 0 COMMENT 'Whether or not all the instance''s posts have been backfilled.' AFTER earliest_reply_in_system;
@@ -1,3 +1,6 @@
ALTER TABLE tu_links CHANGE expanded_url expanded_url VARCHAR( 255 ) NOT NULL DEFAULT '' COMMENT 'Link URL expanded from its shortened form.';
ALTER TABLE tu_users CHANGE last_post_id last_post_id VARCHAR( 80 ) NOT NULL DEFAULT '' COMMENT 'Network post ID of the latest post the user authored.';
ALTER TABLE tu_links CHANGE image_src image_src VARCHAR( 255 ) NOT NULL DEFAULT '' COMMENT 'URL of a thumbnail image associated with this link.'
--
-- Set default value for fields that are set to NO NULL
--
ALTER TABLE tu_links CHANGE expanded_url expanded_url VARCHAR( 255 ) NOT NULL DEFAULT '' COMMENT 'Link URL expanded from its shortened form.';
ALTER TABLE tu_users CHANGE last_post_id last_post_id VARCHAR( 80 ) NOT NULL DEFAULT '' COMMENT 'Network post ID of the latest post the user authored.';
ALTER TABLE tu_links CHANGE image_src image_src VARCHAR( 255 ) NOT NULL DEFAULT '' COMMENT 'URL of a thumbnail image associated with this link.'
@@ -1,12 +1,14 @@
--
-- Comment encoded_locations table
--
CREATE TABLE `tu_encoded_locations_1.1` LIKE tu_encoded_locations;
ALTER TABLE `tu_encoded_locations_1.1` COMMENT = 'Geo-encoded locations.';
ALTER TABLE `tu_encoded_locations_1.1` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT COMMENT 'Internal unique ID.';
ALTER TABLE `tu_encoded_locations_1.1` CHANGE `short_name` `short_name` VARCHAR( 255 ) NOT NULL COMMENT 'Short name of a location, such as NYC.';
ALTER TABLE `tu_encoded_locations_1.1` CHANGE `full_name` `full_name` VARCHAR( 255 ) NOT NULL COMMENT 'Full name of location, such as New York, NY, USA.';
ALTER TABLE `tu_encoded_locations_1.1` CHANGE `latlng` `latlng` VARCHAR( 50 ) NOT NULL COMMENT 'Latitude and longitude coordinates of a place, comma-delimited.';
CREATE TABLE IF NOT EXISTS `tu_encoded_locations_1.1` (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Internal unique ID.',
short_name varchar(255) NOT NULL COMMENT 'Short name of a location, such as NYC.',
full_name varchar(255) NOT NULL COMMENT 'Full name of location, such as New York, NY, USA.',
latlng varchar(50) NOT NULL COMMENT 'Latitude and longitude coordinates of a place, comma-delimited.',
PRIMARY KEY (id),
KEY short_name (short_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Geo-encoded locations.';

INSERT INTO `tu_encoded_locations_1.1` (SELECT * FROM tu_encoded_locations)#rollback=1;

Expand All @@ -20,10 +22,10 @@ DROP TABLE IF EXISTS `tu_encoded_locations_1.0`;
--
-- Comment invites table
--
CREATE TABLE `tu_invites_1.1` LIKE tu_invites;
ALTER TABLE `tu_invites_1.1` COMMENT = 'Individual user registration invitations.';
ALTER TABLE `tu_invites_1.1` CHANGE `invite_code` `invite_code` VARCHAR( 10 ) NULL DEFAULT NULL COMMENT 'Invitation code.';
ALTER TABLE `tu_invites_1.1` CHANGE `created_time` `created_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Time the invitation was created, used to calculate expiration time.';
CREATE TABLE IF NOT EXISTS `tu_invites_1.1` (
invite_code varchar(10) DEFAULT NULL COMMENT 'Invitation code.',
created_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Time the invitation was created, used to calculate expiration time.'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Individual user registration invitations.';

INSERT INTO `tu_invites_1.1` (SELECT * FROM tu_invites)#rollback=1;

Expand All @@ -37,14 +39,17 @@ DROP TABLE IF EXISTS `tu_invites_1.0`;
--
-- Comment options table
--
CREATE TABLE `tu_options_1.1` LIKE tu_options;
ALTER TABLE `tu_options_1.1` COMMENT = 'Application and plugin options or settings.';
ALTER TABLE `tu_options_1.1` CHANGE `option_id` `option_id` INT( 11 ) NOT NULL AUTO_INCREMENT COMMENT 'Unique internal ID.';
ALTER TABLE `tu_options_1.1` CHANGE `namespace` `namespace` VARCHAR( 50 ) NOT NULL COMMENT 'Option namespace, ie, application or specific plugin.';
ALTER TABLE `tu_options_1.1` CHANGE `option_name` `option_name` VARCHAR( 50 ) NOT NULL COMMENT 'Name of option or setting.';
ALTER TABLE `tu_options_1.1` CHANGE `option_value` `option_value` VARCHAR( 255 ) NOT NULL COMMENT 'Value of option.';
ALTER TABLE `tu_options_1.1` CHANGE `last_updated` `last_updated` DATETIME NOT NULL COMMENT 'Last time option was updated.';
ALTER TABLE `tu_options_1.1` CHANGE `created` `created` DATETIME NOT NULL COMMENT 'When option was created.';
CREATE TABLE IF NOT EXISTS `tu_options_1.1` (
option_id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique internal ID.',
namespace varchar(50) NOT NULL COMMENT 'Option namespace, ie, application or specific plugin.',
option_name varchar(50) NOT NULL COMMENT 'Name of option or setting.',
option_value varchar(255) NOT NULL COMMENT 'Value of option.',
last_updated datetime NOT NULL COMMENT 'Last time option was updated.',
created datetime NOT NULL COMMENT 'When option was created.',
PRIMARY KEY (option_id),
KEY namespace_key (namespace),
KEY name_key (option_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Application and plugin options or settings.';

INSERT INTO `tu_options_1.1` (SELECT * FROM tu_options)#rollback=1;

Expand All @@ -58,16 +63,17 @@ DROP TABLE IF EXISTS `tu_options_1.0`;
--
-- Comment plugins table
--
CREATE TABLE `tu_plugins_1.1` LIKE tu_plugins;
ALTER TABLE `tu_plugins_1.1` COMMENT = 'Application plugins.';
ALTER TABLE `tu_plugins_1.1` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT COMMENT 'Internal unique ID.';
ALTER TABLE `tu_plugins_1.1` CHANGE `name` `name` VARCHAR( 255 ) NOT NULL COMMENT 'Plugin display name, such as Hello ThinkUp.';
ALTER TABLE `tu_plugins_1.1` CHANGE `folder_name` `folder_name` VARCHAR( 255 ) NOT NULL COMMENT 'Name of folder where plugin lives.';
ALTER TABLE `tu_plugins_1.1` CHANGE `description` `description` VARCHAR( 255 ) NULL DEFAULT NULL COMMENT 'Plugin description.';
ALTER TABLE `tu_plugins_1.1` CHANGE `author` `author` VARCHAR( 255 ) NULL DEFAULT NULL COMMENT 'Plugin author.';
ALTER TABLE `tu_plugins_1.1` CHANGE `homepage` `homepage` VARCHAR( 255 ) NULL DEFAULT NULL COMMENT 'Plugin homepage URL.';
ALTER TABLE `tu_plugins_1.1` CHANGE `version` `version` VARCHAR( 255 ) NULL DEFAULT NULL COMMENT 'Plugin version.';
ALTER TABLE `tu_plugins_1.1` CHANGE `is_active` `is_active` TINYINT( 4 ) NOT NULL COMMENT 'Whether or not the plugin is activated (1 if so, 0 if not.)';
CREATE TABLE IF NOT EXISTS `tu_plugins_1.1` (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'Internal unique ID.',
name varchar(255) NOT NULL COMMENT 'Plugin display name, such as Hello ThinkUp.',
folder_name varchar(255) NOT NULL COMMENT 'Name of folder where plugin lives.',
description varchar(255) DEFAULT NULL COMMENT 'Plugin description.',
author varchar(255) DEFAULT NULL COMMENT 'Plugin author.',
homepage varchar(255) DEFAULT NULL COMMENT 'Plugin homepage URL.',
version varchar(255) DEFAULT NULL COMMENT 'Plugin version.',
is_active tinyint(4) NOT NULL COMMENT 'Whether or not the plugin is activated (1 if so, 0 if not.)',
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Application plugins.';

INSERT INTO `tu_plugins_1.1` (SELECT * FROM tu_plugins)#rollback=1;

Expand Down

0 comments on commit 9c24ced

Please sign in to comment.