Add sql scripts to favourites table

Fix error logging in DAO layer
feature/traccar-sync
Mohamed Rashd 3 years ago
parent 788eea4e26
commit c0e5edded2

@ -823,7 +823,7 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
log.error(msg, e); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);
} catch (SQLException 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; + appId + " is a favourite app. executed query " + sql;
log.error(msg, e); log.error(msg, e);
throw new ApplicationManagementDAOException(msg, e); throw new ApplicationManagementDAOException(msg, e);

@ -278,3 +278,17 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION(
FOREIGN KEY (APPLICATION_UUID) FOREIGN KEY (APPLICATION_UUID)
REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION 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 CONSTRAINT fk_AP_SCHEDULED_SUBSCRIPTION_AP_APP_RELEASE
FOREIGN KEY (APPLICATION_UUID) FOREIGN KEY (APPLICATION_UUID)
REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION 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, SCHEDULED_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
DELETED BOOLEAN, DELETED BOOLEAN,
PRIMARY KEY (ID) 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) 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, DELETED BOOLEAN,
PRIMARY KEY (ID) 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