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`
-- -----------------------------------------------------
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 (
DEVICE_ID VARCHAR(45) NOT NULL,
GCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL,
@ -21,6 +22,7 @@ CREATE TABLE AD_DEVICE (
-- -----------------------------------------------------
-- 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 (
ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL,

@ -1,6 +1,7 @@
-- -----------------------------------------------------
-- 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 (
DEVICE_ID VARCHAR(45) NOT NULL,
GCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL,
@ -21,6 +22,7 @@ CREATE TABLE AD_DEVICE (
-- -----------------------------------------------------
-- 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 (
ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL,

@ -1,6 +1,7 @@
-- -----------------------------------------------------
-- 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 (
ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL,
@ -12,7 +13,8 @@ CREATE TABLE IOS_FEATURE (
-- -----------------------------------------------------
-- Table `IOS_DEVICE`
-- -----------------------------------------------------
CREATE 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 (
MOBILE_DEVICE_ID VARCHAR(45) NOT NULL,
APNS_PUSH_TOKEN VARCHAR(100) NULL DEFAULT NULL,
MAGIC_TOKEN VARCHAR(100) NULL DEFAULT NULL,

@ -1,6 +1,7 @@
-- -----------------------------------------------------
-- 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 (
ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL,
@ -12,7 +13,8 @@ CREATE TABLE WIN_FEATURE (
-- -----------------------------------------------------
-- Table `WINDOWS_DEVICE`
-- -----------------------------------------------------
CREATE TABLE WIN_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 (
DEVICE_ID VARCHAR(45) NOT NULL,
CHANNEL_URI VARCHAR(100) NULL DEFAULT NULL,
DEVICE_INFO TEXT NULL DEFAULT NULL,

@ -1,6 +1,7 @@
-- -----------------------------------------------------
-- 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 (
ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL,
@ -12,7 +13,8 @@ CREATE TABLE WIN_FEATURE (
-- -----------------------------------------------------
-- Table `WINDOWS_DEVICE`
-- -----------------------------------------------------
CREATE TABLE WIN_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 (
DEVICE_ID VARCHAR(45) NOT NULL,
CHANNEL_URI VARCHAR(100) NULL DEFAULT NULL,
DEVICE_INFO TEXT NULL DEFAULT NULL,

Loading…
Cancel
Save