Fixed issues in Oracle & MSSQL scripts related to wso2/product-iots#1393.

merge-requests/1/head
Harshan Liyanage 7 years ago
parent 9f05a4a1dd
commit 6becd0d40e

@ -3,7 +3,7 @@
-- -----------------------------------------------------
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,
ID INTEGER IDENTITY(1,1) NOT NULL,
CODE VARCHAR(45) NOT NULL,
NAME VARCHAR(100) NULL,
DESCRIPTION VARCHAR(200) NULL,
@ -36,9 +36,9 @@ CREATE TABLE WIN_DEVICE (
-- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[WINDOWS_ENROLLMENT_TOKEN]') AND TYPE IN (N'U'))
CREATE TABLE WINDOWS_ENROLLMENT_TOKEN (
ID INT NOT NULL IDENTITY,
ID INTEGER IDENTITY(1,1) NOT NULL,
TENANT_DOMAIN VARCHAR(45) NOT NULL,
TENANT_ID INT DEFAULT 0,
TENANT_ID INTEGER DEFAULT 0,
ENROLLMENT_TOKEN VARCHAR (100) NULL DEFAULT NULL,
DEVICE_ID VARCHAR (100) NOT NULL,
USERNAME VARCHAR (45) NOT NULL,

@ -23,7 +23,7 @@ CREATE TABLE WIN_DEVICE (
-- Table `WIN_FEATURE`
-- -----------------------------------------------------
CREATE TABLE WIN_FEATURE (
ID INT NOT NULL,
ID NUMBER(10) NOT NULL,
CODE VARCHAR(45) NOT NULL,
NAME VARCHAR(100) NOT NULL,
DESCRIPTION VARCHAR(200) NULL,
@ -35,9 +35,9 @@ CREATE TABLE WIN_FEATURE (
-- Table `WINDOWS_ENROLLMENT_TOKEN`
-- -----------------------------------------------------
CREATE TABLE WINDOWS_ENROLLMENT_TOKEN (
ID INT NOT NULL,
ID NUMBER(10) NOT NULL,
TENANT_DOMAIN VARCHAR(45) NOT NULL,
TENANT_ID INT DEFAULT 0,
TENANT_ID NUMBER(10) DEFAULT 0,
ENROLLMENT_TOKEN VARCHAR(100) NULL,
DEVICE_ID VARCHAR(100) NULL,
USERNAME VARCHAR(45) NULL,
@ -63,4 +63,23 @@ FOR EACH ROW
BEGIN
SELECT WIN_FEATURE_ID_INC_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
END;
/
-- -----------------------------------------------------
-- Sequence `WINDOWS_ENROLLMENT_TOKEN_ID_INC_SEQ`
-- -----------------------------------------------------
CREATE SEQUENCE WINDOWS_ENROLLMENT_TOKEN_ID_INC_SEQ START WITH 1 INCREMENT BY 1 NOCACHE
/
-- -----------------------------------------------------
-- Trigger `WINDOWS_ENROLLMENT_TOKEN_ID_INC_TRIG`
-- -----------------------------------------------------
CREATE OR REPLACE TRIGGER WINDOWS_ENROLLMENT_TOKEN_ID_INC_TRIG
BEFORE INSERT
ON WINDOWS_ENROLLMENT_TOKEN
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT WINDOWS_ENROLLMENT_TOKEN_ID_INC_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
END;
/
Loading…
Cancel
Save