From 29e757cf9bc5aca3a0ab4918814efcc4b4258d40 Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 24 Oct 2019 11:03:07 +0200 Subject: [PATCH] added 'drugs' table to db --- src/main/resources/application-mysql.properties | 2 +- src/main/resources/application.properties | 2 +- src/main/resources/db/mysql/schema.sql | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application-mysql.properties b/src/main/resources/application-mysql.properties index 823b32b69..a69dcc9dd 100644 --- a/src/main/resources/application-mysql.properties +++ b/src/main/resources/application-mysql.properties @@ -2,6 +2,6 @@ database=mysql spring.datasource.url=jdbc:mysql://localhost/petclinic spring.datasource.username=root -spring.datasource.password=petclinic +spring.datasource.password=q1w2e3r4t5 # Uncomment this the first time the app runs # spring.datasource.initialization-mode=always diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b93ff4de3..831a288e0 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ # database init, supports mysql too -database=hsqldb +database=hsql spring.datasource.schema=classpath*:db/${database}/schema.sql spring.datasource.data=classpath*:db/${database}/data.sql diff --git a/src/main/resources/db/mysql/schema.sql b/src/main/resources/db/mysql/schema.sql index 6a9825983..aee53d95e 100644 --- a/src/main/resources/db/mysql/schema.sql +++ b/src/main/resources/db/mysql/schema.sql @@ -63,3 +63,17 @@ CREATE TABLE IF NOT EXISTS visits ( description VARCHAR(255), FOREIGN KEY (pet_id) REFERENCES pets(id) ) engine=InnoDB; + +/* + Add table "drugs" to db + */ + +CREATE TABLE IF NOT EXISTS drugs ( +id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +drug_name VARCHAR(255), +animal_type INT(4) UNSIGNED NOT NULL, +batch_nr INT(4) UNSIGNED NOT NULL, +date_last DATE, +FOREIGN KEY (animal_type) REFERENCES pets(type_id), +FOREIGN KEY (batch_nr) REFERENCES pets(type_id) +) engine=InnoDB;