jessieshannon16 / LibrarySystem

0 stars 0 forks source link

db things #1

Open georgerussellqa opened 1 month ago

georgerussellqa commented 1 month ago

use library;

create table Users ( Id int auto_increment primary key, FirstName Varchar(100) not null, LastName varchar(100) not null, Email varchar(100) not null, Password varchar(255) not null, LastLogin Datetime, IsActive boolean not null );

create table Reservations( Id int auto_increment primary key, UserId int not null, TakeDate datetime not null, FOREIGN KEY (UserId) REFERENCES Users(Id) );

create table BorrowLength( Id int auto_increment primary key, MaxLength int not null );

create table Genre( Id int auto_increment primary key, Name varchar(100) not null );

create table Author( Id int auto_increment primary key, FirstName varchar(100) not null, LastName varchar(100) not null );

create table ContributionLevel ( Id int auto_increment primary key, Level varchar(100) not null );

create table Book ( Isbn varchar(13) primary key, GenreId int not null, BorrowLengthId int not null, Copies int not null, Title varchar (500), Blurb varchar(1000), FOREIGN KEY (GenreId) REFERENCES Genre(Id), FOREIGN KEY (BorrowLengthId) REFERENCES BorrowLength(Id) );

create table BookAuthorMapping ( Id int auto_increment primary key, ReservatinId int not null, BookIsbn varchar(13) not null, ContributionLevelId int not null, FOREIGN KEY (AuthorId) REFERENCES Author(Id), FOREIGN KEY (Isbn) REFERENCES Book(Isbn), FOREIGN KEY (ContributionLevelId) REFERENCES ContributionLevel(Id) );

create table BookReservationMapping ( Id int auto_increment primary key, ReservationId int not null, Isbn varchar(13) not null, ReturnDate datetime, IsReturned bool not null default false, FOREIGN KEY (Isbn) REFERENCES Book(Isbn), FOREIGN KEY (ReservationId) REFERENCES Reservations(Id) );

sebsmithqa commented 1 month ago

mvn clean compile package ; java -jar ./target/-0.0.1-SNAPSHOT.jar

e.g.

mvn clean compile package ; java -jar ./target/main-0.0.1-SNAPSHOT.jar