From cb0700a99c78b92a7fe7c7b5302815f9c44d6ad1 Mon Sep 17 00:00:00 2001 From: Marek Sapota Date: Mon, 17 Oct 2011 13:28:23 -0700 Subject: [PATCH] Allow databases to be created outside upgrade_schema scrpt. Summary: Current scripts make it hard to administer Phabricator instance while not having direct (priviledged) access to the database. This change allows scenario where DB administrator creates the databases for you before you run update_schema script. Test Plan: Create the databases before running the update_schema script - it shouldn't complain that the databases already exist. Reviewers: aran, epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: 1014 --- resources/sql/patches/010.herald.sql | 4 ++-- resources/sql/patches/018.owners.sql | 4 ++-- resources/sql/patches/021.xhpastview.sql | 4 ++-- resources/sql/patches/043.pastebin.sql | 4 ++-- resources/sql/patches/044.countdown.sql | 2 +- resources/sql/patches/053.feed.sql | 2 +- resources/sql/patches/056.slowvote.sql | 4 ++-- resources/sql/patches/060.phriction.sql | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/resources/sql/patches/010.herald.sql b/resources/sql/patches/010.herald.sql index 4ec76332b0..df061e360e 100644 --- a/resources/sql/patches/010.herald.sql +++ b/resources/sql/patches/010.herald.sql @@ -1,4 +1,4 @@ -CREATE DATABASE phabricator_herald; +CREATE DATABASE IF NOT EXISTS phabricator_herald; CREATE TABLE phabricator_herald.herald_action ( id int unsigned not null auto_increment primary key, @@ -41,4 +41,4 @@ CREATE TABLE phabricator_herald.herald_transcript ( conditionTranscripts longblob not null, applyTranscripts longblob not null, unique key (phid) -); \ No newline at end of file +); diff --git a/resources/sql/patches/018.owners.sql b/resources/sql/patches/018.owners.sql index 9628cc3710..0fa822c315 100644 --- a/resources/sql/patches/018.owners.sql +++ b/resources/sql/patches/018.owners.sql @@ -1,4 +1,4 @@ -CREATE DATABASE phabricator_owners; +CREATE DATABASE IF NOT EXISTS phabricator_owners; CREATE TABLE phabricator_owners.owners_package ( id int unsigned not null auto_increment primary key, @@ -24,4 +24,4 @@ CREATE TABLE phabricator_owners.owners_path ( key(packageID), repositoryPHID varchar(64) binary not null, path varchar(255) not null -); \ No newline at end of file +); diff --git a/resources/sql/patches/021.xhpastview.sql b/resources/sql/patches/021.xhpastview.sql index 09ec1b16f0..44c45ddffe 100644 --- a/resources/sql/patches/021.xhpastview.sql +++ b/resources/sql/patches/021.xhpastview.sql @@ -1,4 +1,4 @@ -CREATE DATABASE phabricator_xhpastview; +CREATE DATABASE IF NOT EXISTS phabricator_xhpastview; CREATE TABLE phabricator_xhpastview.xhpastview_parsetree ( id int unsigned not null auto_increment primary key, authorPHID varchar(64) binary, @@ -6,4 +6,4 @@ CREATE TABLE phabricator_xhpastview.xhpastview_parsetree ( stdout longblob not null, dateCreated int unsigned not null, dateModified int unsigned not null -); \ No newline at end of file +); diff --git a/resources/sql/patches/043.pastebin.sql b/resources/sql/patches/043.pastebin.sql index 208ade90a1..6df5f21b3b 100644 --- a/resources/sql/patches/043.pastebin.sql +++ b/resources/sql/patches/043.pastebin.sql @@ -1,4 +1,4 @@ -CREATE DATABASE phabricator_pastebin; +CREATE DATABASE IF NOT EXISTS phabricator_pastebin; CREATE TABLE phabricator_pastebin.pastebin_paste ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -14,4 +14,4 @@ INSERT INTO phabricator_directory.directory_item (name, description, href, categoryID, sequence, dateCreated, dateModified) VALUES ("Paste", "Mmm... tasty, delicious paste.", "/paste/", 5, 150, - UNIX_TIMESTAMP(), UNIX_TIMESTAMP()); \ No newline at end of file + UNIX_TIMESTAMP(), UNIX_TIMESTAMP()); diff --git a/resources/sql/patches/044.countdown.sql b/resources/sql/patches/044.countdown.sql index 77836429a7..38354d2306 100644 --- a/resources/sql/patches/044.countdown.sql +++ b/resources/sql/patches/044.countdown.sql @@ -1,4 +1,4 @@ -CREATE DATABASE phabricator_countdown; +CREATE DATABASE IF NOT EXISTS phabricator_countdown; CREATE TABLE phabricator_countdown.countdown_timer ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, diff --git a/resources/sql/patches/053.feed.sql b/resources/sql/patches/053.feed.sql index 17dd8b2da7..c0893fb62f 100644 --- a/resources/sql/patches/053.feed.sql +++ b/resources/sql/patches/053.feed.sql @@ -1,4 +1,4 @@ -CREATE DATABASE phabricator_feed; +CREATE DATABASE IF NOT EXISTS phabricator_feed; CREATE TABLE phabricator_feed.feed_storydata ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, diff --git a/resources/sql/patches/056.slowvote.sql b/resources/sql/patches/056.slowvote.sql index dd877deba9..829d73dfbc 100644 --- a/resources/sql/patches/056.slowvote.sql +++ b/resources/sql/patches/056.slowvote.sql @@ -1,4 +1,4 @@ -CREATE DATABASE phabricator_slowvote; +CREATE DATABASE IF NOT EXISTS phabricator_slowvote; CREATE TABLE phabricator_slowvote.slowvote_poll ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -47,4 +47,4 @@ INSERT INTO phabricator_directory.directory_item (name, description, href, categoryID, sequence, dateCreated, dateModified) VALUES ("Slowvote", "Design by committee.", "/vote/", 5, 250, - UNIX_TIMESTAMP(), UNIX_TIMESTAMP()); \ No newline at end of file + UNIX_TIMESTAMP(), UNIX_TIMESTAMP()); diff --git a/resources/sql/patches/060.phriction.sql b/resources/sql/patches/060.phriction.sql index d09752e840..c7f5efee4b 100644 --- a/resources/sql/patches/060.phriction.sql +++ b/resources/sql/patches/060.phriction.sql @@ -1,4 +1,4 @@ -CREATE DATABASE phabricator_phriction; +CREATE DATABASE IF NOT EXISTS phabricator_phriction; CREATE TABLE phabricator_phriction.phriction_document ( id INT UNSIGNED NOT NULL, @@ -9,4 +9,4 @@ CREATE TABLE phabricator_phriction.phriction_document ( depth INT UNSIGNED NOT NULL, UNIQUE KEY (depth, slug), contentID INT UNSIGNED NOT NULL -) ENGINE=InnoDB; \ No newline at end of file +) ENGINE=InnoDB;