diff --git a/pom.xml b/pom.xml index ff677d097..b6f02e51e 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,14 @@ runtime + + + com.splicemachine + db-client + 2.6.0.1725-SNAPSHOT + + + javax.cache diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index fb07c6c50..b38520e67 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,8 +1,14 @@ # database init, supports mysql too -database=hsqldb +database=splicemachine spring.datasource.schema=classpath*:db/${database}/schema.sql spring.datasource.data=classpath*:db/${database}/data.sql + +spring.datasource.url=jdbc:splice://localhost:1527/splicedb;user=splice;password=admin +spring.datasource.username=splice +spring.datasource.password=admin +spring.datasource.driver-class-name=com.splicemachine.db.jdbc.ClientDriver +spring.jpa.database-platform=org.hibernate.dialect.DerbyTenSevenDialect # Web spring.thymeleaf.mode=HTML diff --git a/src/main/resources/db/hsqldb/data.sql b/src/main/resources/db/splicemachine/data.sql similarity index 100% rename from src/main/resources/db/hsqldb/data.sql rename to src/main/resources/db/splicemachine/data.sql diff --git a/src/main/resources/db/hsqldb/schema.sql b/src/main/resources/db/splicemachine/schema.sql similarity index 66% rename from src/main/resources/db/hsqldb/schema.sql rename to src/main/resources/db/splicemachine/schema.sql index f3c6947b7..9d1698ee9 100644 --- a/src/main/resources/db/hsqldb/schema.sql +++ b/src/main/resources/db/splicemachine/schema.sql @@ -1,22 +1,15 @@ -DROP TABLE vet_specialties IF EXISTS; -DROP TABLE vets IF EXISTS; -DROP TABLE specialties IF EXISTS; -DROP TABLE visits IF EXISTS; -DROP TABLE pets IF EXISTS; -DROP TABLE types IF EXISTS; -DROP TABLE owners IF EXISTS; - - CREATE TABLE vets ( - id INTEGER IDENTITY PRIMARY KEY, + id INTEGER GENERATED ALWAYS AS IDENTITY, first_name VARCHAR(30), - last_name VARCHAR(30) + last_name VARCHAR(30), + primary key (id) ); CREATE INDEX vets_last_name ON vets (last_name); CREATE TABLE specialties ( - id INTEGER IDENTITY PRIMARY KEY, - name VARCHAR(80) + id INTEGER GENERATED ALWAYS AS IDENTITY, + name VARCHAR(80), + primary key(id) ); CREATE INDEX specialties_name ON specialties (name); @@ -28,37 +21,41 @@ ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_vets FOREIGN KEY ( ALTER TABLE vet_specialties ADD CONSTRAINT fk_vet_specialties_specialties FOREIGN KEY (specialty_id) REFERENCES specialties (id); CREATE TABLE types ( - id INTEGER IDENTITY PRIMARY KEY, - name VARCHAR(80) + id INTEGER GENERATED ALWAYS AS IDENTITY, + name VARCHAR(80), + primary key (id) ); CREATE INDEX types_name ON types (name); CREATE TABLE owners ( - id INTEGER IDENTITY PRIMARY KEY, + id INTEGER GENERATED ALWAYS AS IDENTITY, first_name VARCHAR(30), - last_name VARCHAR_IGNORECASE(30), + last_name VARCHAR(30), address VARCHAR(255), city VARCHAR(80), - telephone VARCHAR(20) + telephone VARCHAR(20), + primary key (id) ); CREATE INDEX owners_last_name ON owners (last_name); CREATE TABLE pets ( - id INTEGER IDENTITY PRIMARY KEY, + id INTEGER GENERATED ALWAYS AS IDENTITY, name VARCHAR(30), birth_date DATE, type_id INTEGER NOT NULL, - owner_id INTEGER NOT NULL + owner_id INTEGER NOT NULL, + primary key (id) ); ALTER TABLE pets ADD CONSTRAINT fk_pets_owners FOREIGN KEY (owner_id) REFERENCES owners (id); ALTER TABLE pets ADD CONSTRAINT fk_pets_types FOREIGN KEY (type_id) REFERENCES types (id); CREATE INDEX pets_name ON pets (name); CREATE TABLE visits ( - id INTEGER IDENTITY PRIMARY KEY, + id INTEGER GENERATED ALWAYS AS IDENTITY, pet_id INTEGER NOT NULL, visit_date DATE, - description VARCHAR(255) + description VARCHAR(255), + primary key (id) ); ALTER TABLE visits ADD CONSTRAINT fk_visits_pets FOREIGN KEY (pet_id) REFERENCES pets (id); CREATE INDEX visits_pet_id ON visits (pet_id);