Updated MSSQL scripts to have IF-NOT-EXISTS statements

revert-dabc3590
harshanl 8 years ago
parent 2ad390b877
commit df6b0f9612

@ -1,6 +1,7 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `AD_DEVICE` -- Table `AD_DEVICE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AD_DEVICE]') AND TYPE IN (N'U'))
CREATE TABLE AD_DEVICE ( CREATE TABLE AD_DEVICE (
DEVICE_ID VARCHAR(45) NOT NULL, DEVICE_ID VARCHAR(45) NOT NULL,
GCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL, GCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL,
@ -21,6 +22,7 @@ CREATE TABLE AD_DEVICE (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `AD_FEATURE` -- Table `AD_FEATURE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AD_FEATURE]') AND TYPE IN (N'U'))
CREATE TABLE AD_FEATURE ( CREATE TABLE AD_FEATURE (
ID INT NOT NULL IDENTITY, ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL, CODE VARCHAR(45) NOT NULL,

@ -1,6 +1,7 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `AD_DEVICE` -- Table `AD_DEVICE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AD_DEVICE]') AND TYPE IN (N'U'))
CREATE TABLE AD_DEVICE ( CREATE TABLE AD_DEVICE (
DEVICE_ID VARCHAR(45) NOT NULL, DEVICE_ID VARCHAR(45) NOT NULL,
GCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL, GCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL,
@ -21,6 +22,7 @@ CREATE TABLE AD_DEVICE (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `AD_FEATURE` -- Table `AD_FEATURE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AD_FEATURE]') AND TYPE IN (N'U'))
CREATE TABLE AD_FEATURE ( CREATE TABLE AD_FEATURE (
ID INT NOT NULL IDENTITY, ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL, CODE VARCHAR(45) NOT NULL,

@ -1,6 +1,7 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `IOS_FEATURE` -- Table `IOS_FEATURE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IOS_FEATURE]') AND TYPE IN (N'U'))
CREATE TABLE IOS_FEATURE ( CREATE TABLE IOS_FEATURE (
ID INT NOT NULL IDENTITY, ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL, CODE VARCHAR(45) NOT NULL,
@ -12,6 +13,7 @@ CREATE TABLE IOS_FEATURE (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `IOS_DEVICE` -- Table `IOS_DEVICE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IOS_DEVICE]') AND TYPE IN (N'U'))
CREATE TABLE IOS_DEVICE ( CREATE TABLE IOS_DEVICE (
MOBILE_DEVICE_ID VARCHAR(45) NOT NULL, MOBILE_DEVICE_ID VARCHAR(45) NOT NULL,
APNS_PUSH_TOKEN VARCHAR(100) NULL DEFAULT NULL, APNS_PUSH_TOKEN VARCHAR(100) NULL DEFAULT NULL,

@ -1,6 +1,7 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `WINDOWS_FEATURE` -- Table `WINDOWS_FEATURE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WIN_FEATURE]') AND TYPE IN (N'U'))
CREATE TABLE WIN_FEATURE ( CREATE TABLE WIN_FEATURE (
ID INT NOT NULL IDENTITY, ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL, CODE VARCHAR(45) NOT NULL,
@ -12,6 +13,7 @@ CREATE TABLE WIN_FEATURE (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `WINDOWS_DEVICE` -- Table `WINDOWS_DEVICE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WIN_DEVICE]') AND TYPE IN (N'U'))
CREATE TABLE WIN_DEVICE ( CREATE TABLE WIN_DEVICE (
DEVICE_ID VARCHAR(45) NOT NULL, DEVICE_ID VARCHAR(45) NOT NULL,
CHANNEL_URI VARCHAR(100) NULL DEFAULT NULL, CHANNEL_URI VARCHAR(100) NULL DEFAULT NULL,

@ -1,6 +1,7 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `WINDOWS_FEATURE` -- Table `WINDOWS_FEATURE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WIN_FEATURE]') AND TYPE IN (N'U'))
CREATE TABLE WIN_FEATURE ( CREATE TABLE WIN_FEATURE (
ID INT NOT NULL IDENTITY, ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL, CODE VARCHAR(45) NOT NULL,
@ -12,6 +13,7 @@ CREATE TABLE WIN_FEATURE (
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `WINDOWS_DEVICE` -- Table `WINDOWS_DEVICE`
-- ----------------------------------------------------- -- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WIN_DEVICE]') AND TYPE IN (N'U'))
CREATE TABLE WIN_DEVICE ( CREATE TABLE WIN_DEVICE (
DEVICE_ID VARCHAR(45) NOT NULL, DEVICE_ID VARCHAR(45) NOT NULL,
CHANNEL_URI VARCHAR(100) NULL DEFAULT NULL, CHANNEL_URI VARCHAR(100) NULL DEFAULT NULL,

Loading…
Cancel
Save