Table creation on longer tries to occur if it already exists.
This commit is contained in:
parent
366ead48cf
commit
7e0d58200f
1
.gitignore
vendored
1
.gitignore
vendored
@ -192,3 +192,4 @@ backend/src/main/resources/assets
|
||||
frontend/node
|
||||
!maven-wrapper.jar
|
||||
dependency-reduced-pom.xml
|
||||
*.db
|
@ -13,12 +13,12 @@ import uk.co.neviyn.Observations.core.Observation;
|
||||
@RegisterRowMapper(Observation.Mapper.class)
|
||||
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, " +
|
||||
"rawData TEXT, date DATE)")
|
||||
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))")
|
||||
void createObservationTutorTable();
|
||||
|
||||
|
@ -10,7 +10,7 @@ import uk.co.neviyn.Observations.core.Site;
|
||||
@RegisterRowMapper(Site.Mapper.class)
|
||||
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();
|
||||
|
||||
@SqlQuery("SELECT * FROM site")
|
||||
|
@ -12,7 +12,7 @@ import uk.co.neviyn.Observations.core.Tutor;
|
||||
@RegisterRowMapper(Tutor.Mapper.class)
|
||||
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))")
|
||||
void createTutorTable();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user