-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresetDB.sql
More file actions
38 lines (28 loc) · 1.15 KB
/
resetDB.sql
File metadata and controls
38 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- Zane Reick, My Midwest reset testing Database to default values.
-- Create Database if it doesn't exist
CREATE DATABASE IF NOT EXISTS MyMidwest_v1;
USE MyMidwest_v1;
-- Drop old tables, and create new ones
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS posts;
CREATE TABLE users (
uid INT UNSIGNED AUTO_INCREMENT NOT NULL UNIQUE KEY PRIMARY KEY,
username VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
firstName VARCHAR(255) NOT NULL,
lastName VARCHAR(255) NOT NULL,
company VARCHAR(255) DEFAULT NULL
);
CREATE TABLE posts (
pid INT UNSIGNED AUTO_INCREMENT NOT NULL UNIQUE KEY PRIMARY KEY,
title VARCHAR(255) NOT NULL,
author VARCHAR(255) NOT NULL,
submitDate VARCHAR(255) NOT NULL,
content VARCHAR(2048) NOT NULL,
tags VARCHAR(255) DEFAULT NULL
);
-- Insert defaults into tables
INSERT INTO users (username, password, firstName, lastName, company) VALUES
("admin", "password", "Admin", "Istrator", "Unknown Technology Solutions");
INSERT INTO posts (title, author, submitDate, content, tags) VALUES
("Test Post", "Admin", "10/16/2020", "This is a test post.", "test,admin,posting,testing");