Skip to content
Snippets Groups Projects
Commit 0a57d4e9 authored by Joshua Grey's avatar Joshua Grey
Browse files

Updated SQL

parent 81f49ffb
No related branches found
No related tags found
No related merge requests found
spring.datasource.url=jdbc:mariadb://localhost:3306/takeaway
spring.datasource.url=jdbc:mariadb://localhost:3306/cms
spring.datasource.username=root
spring.datasource.password=comsc
spring.sql.init.mode=always
delete from complaint;
insert into complaint(
complainantName ,
policyHolderName ,
policyNumber ,
DateTime ,
address ,
telephone_number ,
complaint_method ,
complaint_fcaType ,
complaint_status ,
text_box ) values ( 'Tom' , 'Tom', '12c' , CURRENT_DATE, 'Cathays, cardiff',
'07778181838','Email', 'Regulatory', 'open'
)
)
\ No newline at end of file
drop table if exists complaint
create table if not exists complaint(
complaint_id bigint auto_increment primary key,
complainantName varchar (128),
policyHolderName varchar (128),
policyNumber varchar,
DateTime TIMESTAMP,
address varchar,
telephone_number int,
complaint_method varchar,
complaint_fcaType varchar,
complaint_status boolean,
text_box varchar
) engine=InnoDB;
\ No newline at end of file
delete from complaint_method;
delete from fca_option;
delete from complaint;
-- Complaint method values
insert into complaint_method(method)
values ('website');
insert into complaint_method(method)
values ('email');
insert into complaint_method(method)
values ('telephone');
insert into complaint_method(method)
values ('in-person');
-- FCA options
insert into fca_option(option)
values ('TBD');
insert into fca_option(option)
values ('FCA');
insert into fca_option(option)
values ('Non-FCA');
-- Test complaints
insert into complaint(
title,
policy_holder_name,
policy_number,
date_time_submitted,
address,
telephone_number,
method,
fca,
status,
text_box)
values ('Complaint title!' , 'Tom', '12214' , CURRENT_DATE, 'Cathays, cardiff',
'07778181838', 2, 1, true, 'Detials of the complaint'
);
insert into complaint(
title,
policy_holder_name,
policy_number,
date_time_submitted,
address,
telephone_number,
method,
fca,
status,
text_box)
values ('Another complaint' , 'Bob', '12212134' , CURRENT_DATE, 'Cathays, cardiff',
'07278184888', 1, 2, false, 'Detials of another complaint can go here!'
)
use cms;
drop table if exists complaint;
drop table if exists complaint_method;
drop table if exists fca_option;
create table if not exists complaint_method(
id int auto_increment not null,
method varchar(128),
PRIMARY KEY (id)
);
create table if not exists fca_option(
id int auto_increment not null,
option varchar(128),
PRIMARY KEY (id)
);
create table if not exists complaint(
id bigint auto_increment,
title varchar(128) not null,
policy_holder_name varchar(128),
policy_number varchar(128) null,
date_time_submitted timestamp not null,
address varchar(256),
telephone_number varchar(11),
method int not null,
fca int not null,
status boolean not null,
text_box varchar(8192),
PRIMARY KEY (id),
FOREIGN KEY (method) REFERENCES complaint_method(id),
FOREIGN KEY (fca) REFERENCES fca_option(id)
);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment