mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 14:55:51 +00:00
Added medicine table and medicine class
This commit is contained in:
parent
32301ed531
commit
8f6833b82c
3 changed files with 43 additions and 0 deletions
|
@ -0,0 +1,31 @@
|
|||
package org.springframework.samples.petclinic.medicine;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "medicines")
|
||||
public class Medicine {
|
||||
|
||||
@Column(name = "med_name")
|
||||
private String medName;
|
||||
@Column(name = "pet_type")
|
||||
private String petType;
|
||||
|
||||
public String getPetType() {
|
||||
return petType;
|
||||
}
|
||||
|
||||
public void setPetType(String petType) {
|
||||
this.petType = petType;
|
||||
}
|
||||
|
||||
public String getMedName() {
|
||||
return medName;
|
||||
}
|
||||
|
||||
public void setMedName(String medName) {
|
||||
this.medName = medName;
|
||||
}
|
||||
}
|
|
@ -62,3 +62,9 @@ CREATE TABLE visits (
|
|||
);
|
||||
ALTER TABLE visits ADD CONSTRAINT fk_visits_pets FOREIGN KEY (pet_id) REFERENCES pets (id);
|
||||
CREATE INDEX visits_pet_id ON visits (pet_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS medicine (
|
||||
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
med_name VARCHAR(30),
|
||||
pet_type VARCHAR(30),
|
||||
)
|
||||
|
|
|
@ -63,3 +63,9 @@ CREATE TABLE IF NOT EXISTS visits (
|
|||
description VARCHAR(255),
|
||||
FOREIGN KEY (pet_id) REFERENCES pets(id)
|
||||
) engine=InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS medicines (
|
||||
id INT(4) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
med_name VARCHAR(30),
|
||||
pet_type VARCHAR(30),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue