Skip to content
Snippets Groups Projects
Commit e847822d authored by Gabriel Copat's avatar Gabriel Copat
Browse files

Adjusted schema.sql to be more readable;

parent 1ac09504
No related branches found
No related tags found
1 merge request!37Resolve "As a repeat trail visitor , I want to be able to create an account so I can save and review my progress."
...@@ -10,7 +10,6 @@ import java.util.List; ...@@ -10,7 +10,6 @@ import java.util.List;
@Repository @Repository
public class RewardsRepositoryJDBC implements RewardsRepository { public class RewardsRepositoryJDBC implements RewardsRepository {
private final JdbcTemplate jdbc; private final JdbcTemplate jdbc;
private RowMapper<Badge> badgeMapper;
private RowMapper<Sticker> stickerMapper; private RowMapper<Sticker> stickerMapper;
private RowMapper<Pack> packMapper; private RowMapper<Pack> packMapper;
......
drop table if exists trails; /* DELETES AND RECREATES DATABASE EVERY TIME THE SYSTEM IS BOOTED*/
create table if not exists trails DROP DATABASE IF EXISTS towns;
( CREATE DATABASE IF NOT EXISTS towns;
USE towns;
/****************************************************************/
/* DROPS ALL TABLES IF THEY EXIST (they wont but just in case) */
DROP TABLE IF EXISTS trails;
DROP TABLE IF EXISTS locations;
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS stickers;
DROP TABLE IF EXISTS packs;
DROP TABLE IF EXISTS stickerProgress;
/****************************************************************/
/* CREATES ALL TABLES */
CREATE TABLE IF NOT EXISTS trails (
trailID bigint auto_increment primary key, trailID bigint auto_increment primary key,
name varchar(128) name varchar(128)
) engine=InnoDB; );
drop table if exists locations; CREATE TABLE IF NOT EXISTS locations (
create table if not exists locations
(
locationID bigint auto_increment primary key, locationID bigint auto_increment primary key,
locationName varchar(128), locationName varchar(128),
locationEmail varchar(128), locationEmail varchar(128),
locationDescription longtext, locationDescription longtext,
locationPlace varchar(255), locationPlace varchar(255),
locationTrailID varchar(128) locationTrailID varchar(128)
) engine=InnoDB; );
drop table if exists users;
drop table if exists stickers;
drop table if exists packs;
drop table if exists stickerProgress;
create table if not exists users CREATE TABLE IF NOT EXISTS users (
(
id bigint auto_increment primary key, id bigint auto_increment primary key,
email varchar(128) NOT NULL , email varchar(128) NOT NULL ,
name varchar(30), name varchar(30),
dragonProgress int, dragonProgress int,
dragonsLandmarkIDs longtext dragonsLandmarkIDs longtext
) engine=InnoDB; );
CREATE TABLE IF NOT EXISTS packs (
create table if not exists packs
(
id bigint auto_increment primary key, id bigint auto_increment primary key,
name varchar(20), name varchar(20),
description text description text
) engine=InnoDB; );
create table if not exists stickers CREATE TABLE IF NOT EXISTS stickers (
(
id bigint auto_increment primary key, id bigint auto_increment primary key,
packID bigint, packID bigint,
FOREIGN KEY (packID) REFERENCES packs(id) FOREIGN KEY (packID) REFERENCES packs(id)
...@@ -51,14 +53,11 @@ create table if not exists stickers ...@@ -51,14 +53,11 @@ create table if not exists stickers
name varchar(30), name varchar(30),
description text, description text,
rarity tinyint rarity tinyint
);
) engine=InnoDB; CREATE TABLE IF NOT EXISTS stickerProgress (
create table if not exists stickerProgress
(
id bigint auto_increment primary key, id bigint auto_increment primary key,
userID bigint, userID bigint,
packID bigint, packID bigint,
stickerID bigint stickerID bigint
);
) engine=InnoDB;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment