From 9c76fc921c6c2eaa59c458b275aeba9a409b1979 Mon Sep 17 00:00:00 2001 From: zhengxie Date: Tue, 22 Jul 2014 17:32:39 +0800 Subject: [PATCH] [scripts] Add missing "if not exists" to sqls --- scripts/upgrade/sql/3.1.0/mysql/seahub.sql | 2 +- scripts/upgrade/sql/3.1.0/sqlite3/seahub.sql | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade/sql/3.1.0/mysql/seahub.sql b/scripts/upgrade/sql/3.1.0/mysql/seahub.sql index cef2aa6a9..8bcde123b 100644 --- a/scripts/upgrade/sql/3.1.0/mysql/seahub.sql +++ b/scripts/upgrade/sql/3.1.0/mysql/seahub.sql @@ -7,7 +7,7 @@ alter table share_uploadlinkshare add column password varchar(128); alter table share_uploadlinkshare add column expire_date datetime; alter table profile_profile add column lang_code varchar(50) DEFAULT NULL; -CREATE TABLE `share_orgfileshare` ( +CREATE TABLE IF NOT EXISTS `share_orgfileshare` ( `id` int(11) NOT NULL AUTO_INCREMENT, `org_id` int(11) NOT NULL, `file_share_id` int(11) NOT NULL, diff --git a/scripts/upgrade/sql/3.1.0/sqlite3/seahub.sql b/scripts/upgrade/sql/3.1.0/sqlite3/seahub.sql index ddaf4cd4d..dcd6306b8 100644 --- a/scripts/upgrade/sql/3.1.0/sqlite3/seahub.sql +++ b/scripts/upgrade/sql/3.1.0/sqlite3/seahub.sql @@ -6,9 +6,10 @@ alter table "share_uploadlinkshare" add column "password" varchar(128); alter table "share_uploadlinkshare" add column "expire_date" datetime; alter table "profile_profile" add column "lang_code" varchar(50); -CREATE TABLE "share_orgfileshare" ( +CREATE TABLE IF NOT EXISTS "share_orgfileshare" ( "id" integer NOT NULL PRIMARY KEY, "org_id" integer NOT NULL, "file_share_id" integer NOT NULL UNIQUE REFERENCES "share_fileshare" ("id") ); -CREATE INDEX "share_orgfileshare_944dadb6" ON "share_orgfileshare" ("org_id"); +CREATE INDEX IF NOT EXISTS "share_orgfileshare_944dadb6" ON "share_orgfileshare" ("org_id"); +