Merge branch 'add/sql/scripts/favourites' into 'master'

Add sql scripts to add app favouties table

See merge request entgra/carbon-device-mgt!872
temp
Dharmakeerthi Lasantha 3 years ago
commit 9292b3b6dd

@ -823,7 +823,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException e) {
String msg = "Error occurred while obtaining the DB connection to check whether the application with the id "
String msg = "SQL Error occurred while checking whether the application with the id "
+ appId + " is a favourite app. executed query " + sql;
log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e);

@ -278,3 +278,17 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION(
FOREIGN KEY (APPLICATION_UUID)
REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
-- -----------------------------------------------------
-- Table AP_APP_FAVOURITES
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
ID INTEGER NOT NULL AUTO_INCREMENT,
AP_APP_ID INTEGER NOT NULL,
USER_NAME VARCHAR(100) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY(ID),
CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);

@ -278,4 +278,18 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION(
CONSTRAINT fk_AP_SCHEDULED_SUBSCRIPTION_AP_APP_RELEASE
FOREIGN KEY (APPLICATION_UUID)
REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
);
-- -----------------------------------------------------
-- Table AP_APP_FAVOURITES
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
ID INTEGER NOT NULL IDENTITY,
AP_APP_ID INTEGER NOT NULL,
USER_NAME VARCHAR(100) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY(ID),
CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID)
);

@ -274,4 +274,18 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION(
SCHEDULED_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
DELETED BOOLEAN,
PRIMARY KEY (ID)
);
);
-- -----------------------------------------------------
-- Table AP_APP_FAVOURITES
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
ID INTEGER NOT NULL AUTO_INCREMENT,
AP_APP_ID INTEGER NOT NULL,
USER_NAME VARCHAR(100) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY(ID),
CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID)
);

@ -382,3 +382,15 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION (
REFERENCES AP_APP_RELEASE (UUID)
)
/
CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
ID number GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL,
AP_APP_ID INTEGER NOT NULL,
USER_NAME VARCHAR(100) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY(ID),
CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID)
)
/

@ -305,3 +305,18 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION(
DELETED BOOLEAN,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_APP_FAVOURITES
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_FAVOURITES_seq'),
AP_APP_ID INTEGER NOT NULL,
USER_NAME VARCHAR(100) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY(ID),
CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk
FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);

Loading…
Cancel
Save