Table creation on longer tries to occur if it already exists.
This commit is contained in:
parent
366ead48cf
commit
7e0d58200f
3
.gitignore
vendored
3
.gitignore
vendored
@ -191,4 +191,5 @@ typings/
|
|||||||
backend/src/main/resources/assets
|
backend/src/main/resources/assets
|
||||||
frontend/node
|
frontend/node
|
||||||
!maven-wrapper.jar
|
!maven-wrapper.jar
|
||||||
dependency-reduced-pom.xml
|
dependency-reduced-pom.xml
|
||||||
|
*.db
|
@ -13,12 +13,12 @@ import uk.co.neviyn.Observations.core.Observation;
|
|||||||
@RegisterRowMapper(Observation.Mapper.class)
|
@RegisterRowMapper(Observation.Mapper.class)
|
||||||
public interface ObservationDao {
|
public interface ObservationDao {
|
||||||
|
|
||||||
@SqlUpdate("CREATE TABLE observations (id INTEGER PRIMARY KEY AUTO_INCREMENT, siteId INTEGER, tutorManyId INTEGER, " +
|
@SqlUpdate("CREATE TABLE IF NOT EXISTS observations (id INTEGER PRIMARY KEY, siteId INTEGER, tutorManyId INTEGER, " +
|
||||||
"observed TEXT, monitoring INTEGER, control INTEGER, conservatism INTEGER, teamwork INTEGER, knowledge INTEGER, " +
|
"observed TEXT, monitoring INTEGER, control INTEGER, conservatism INTEGER, teamwork INTEGER, knowledge INTEGER, " +
|
||||||
"rawData TEXT, date DATE)")
|
"rawData TEXT, date DATE)")
|
||||||
void createObservationTable();
|
void createObservationTable();
|
||||||
|
|
||||||
@SqlUpdate("CREATE TABLE observation_tutor (tutorId INT NOT NULL, observationId INT NOT NULL, " +
|
@SqlUpdate("CREATE TABLE IF NOT EXISTS observation_tutor (tutorId INT NOT NULL, observationId INT NOT NULL, " +
|
||||||
"FOREIGN KEY (tutorID) REFERENCES tutor(id), FOREIGN KEY (observationId) REFERENCES observations(id))")
|
"FOREIGN KEY (tutorID) REFERENCES tutor(id), FOREIGN KEY (observationId) REFERENCES observations(id))")
|
||||||
void createObservationTutorTable();
|
void createObservationTutorTable();
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import uk.co.neviyn.Observations.core.Site;
|
|||||||
@RegisterRowMapper(Site.Mapper.class)
|
@RegisterRowMapper(Site.Mapper.class)
|
||||||
public interface SiteDao {
|
public interface SiteDao {
|
||||||
|
|
||||||
@SqlUpdate("CREATE TABLE site (id INTEGER PRIMARY KEY AUTO_INCREMENT, name VARCHAR(100))")
|
@SqlUpdate("CREATE TABLE IF NOT EXISTS site (id INTEGER PRIMARY KEY, name VARCHAR(100))")
|
||||||
void createSiteTable();
|
void createSiteTable();
|
||||||
|
|
||||||
@SqlQuery("SELECT * FROM site")
|
@SqlQuery("SELECT * FROM site")
|
||||||
|
@ -12,7 +12,7 @@ import uk.co.neviyn.Observations.core.Tutor;
|
|||||||
@RegisterRowMapper(Tutor.Mapper.class)
|
@RegisterRowMapper(Tutor.Mapper.class)
|
||||||
public interface TutorDao {
|
public interface TutorDao {
|
||||||
|
|
||||||
@SqlUpdate("CREATE TABLE tutor (id INTEGER PRIMARY KEY AUTO_INCREMENT, " +
|
@SqlUpdate("CREATE TABLE IF NOT EXISTS tutor (id INTEGER PRIMARY KEY, " +
|
||||||
"name VARCHAR(100), site INT, FOREIGN KEY (site) REFERENCES site(id))")
|
"name VARCHAR(100), site INT, FOREIGN KEY (site) REFERENCES site(id))")
|
||||||
void createTutorTable();
|
void createTutorTable();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user