Add database creation and test data insert scripts

Use these files to generate a test database. This will also allow
for the tracking of schema changes.
This commit is contained in:
Roan Horning 2022-06-29 00:45:27 -04:00
parent e31c4a2208
commit 3bab143697
No known key found for this signature in database
GPG Key ID: 6E07059BD168E395
5 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,8 @@
CREATE TABLE Contributors (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
handle varchar(255) NOT NULL,
email varchar(255) NOT NULL,
avatar varchar(255) DEFAULT 'hpr_logo.png' NOT NULL,
default_license VARCHAR(25) DEFAULT 'CC BY-SA 4.0' NOT NULL,
profile TEXT
);

View File

@ -0,0 +1,13 @@
CREATE TABLE Episodes (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
correspondent_id INTEGER NOT NULL,
is_explicit BOOLEAN DEFAULT 1 NOT NULL,
submitted DATETIME NOT NULL,
published DATETIME,
license VARCHAR(25) DEFAULT 'CC BY-SA 4.0' NOT NULL,
title VARCHAR(100) NOT NULL,
summary VARCHAR(100) NOT NULL,
series VARCHAR(100),
show_notes TEXT NOT NULL,
CONSTRAINT Episodes_FK FOREIGN KEY (correspondent_id) REFERENCES Episodes(id)
);

View File

@ -0,0 +1,5 @@
CREATE TABLE Tag_To_Episodes (
tag_id INTEGER NOT NULL,
episode_id INTEGER NOT NULL,
CONSTRAINT Tag_To_Episodes_PK PRIMARY KEY (tag_id,episode_id)
);

View File

@ -0,0 +1,5 @@
CREATE TABLE Tags (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
tag varchar(100)
);
CREATE UNIQUE INDEX Tags_tag_IDX ON Tags (tag);

27
_sql/Insert_Test_Data.sql Normal file
View File

@ -0,0 +1,27 @@
INSERT INTO Contributors
(id, handle, email, avatar, default_license, profile)
VALUES(1, 'droops', 'droops.nospam@nospam.gmail.com', '1.png', 'CC-BY-NC-SA', 'nomicon.info');
INSERT INTO Contributors
(id, handle, email, avatar, default_license, profile)
VALUES(3, 'dosman', 'dosman.nospam@nospam.packetsniffers.org', 'hpr_logo.png', 'CC-BY-SA', 'packetsniffers.org');
INSERT INTO Episodes
(id, correspondent_id, is_explicit, submitted, published, license, title, summary, series, show_notes)
VALUES(6, 3, 1, '2008-01-08', '2008-01-08', 'CC-BY-NC-SA', 'Part 15 Broadcasting', 'dosman and zach from the packetsniffers talk about Part 15 Broadcasting which is low power', NULL, '<p>dosman and zach from the packetsniffers talk about Part 15 Broadcasting which is low power broadcasting for the local area. Used to do community radio around an event, a church, concerts etc. They discuss what the regulations are in the US, what you need, how to get started, what things to consider. All in all great introduction to the topic.
</p>
<h2>links</h2>
<ul>
<li>Part 15 broadcasting resources: <a href="https://www.part15.us">https://www.part15.us</a></li>
<li>SSTRAN AMT3000 part 15 transmitter: <a href="https://www.sstran.com">https://www.sstran.com</a></li>
<li>FCC Low Power Broadcast Radio Stations: <a href="https://www.fcc.gov/guides/low-power-broadcast-radio-stations">https://www.fcc.gov/guides/low-power-broadcast-radio-stations</a></li>
<li>Windows Radio Broadcast software: <a href="https://www.zarastudio.es/en/ ">https://www.zarastudio.es/en/ </a></li>
</ul>');
INSERT INTO Episodes
(id, correspondent_id, is_explicit, submitted, published, license, title, summary, series, show_notes)
VALUES(35, 1, 1, '2008-02-18', '2008-02-18', 'CC-BY-NC-SA', 'An interview with John Whaley', 'droops interviews John Whaley from Moka5', 'Interviews', '<p>
droops interviews John Whaley from <a href="https://www.moka5.com/about-us/our-team/john-whaley/"> Moka5.</a>
</p>
<p>
John Whaley is responsible for the technical vision of Moka5. He holds a doctorate in computer science from Stanford University, where he made key contributions to the fields of program analysis, compilers, and virtual machines. He is the winner of numerous awards including the Arthur L. Samuel Thesis Award for Best Thesis at Stanford, and has worked at IBMs T.J. Watson Research Center and Tokyo Research Lab. John was named one of the top 15 programmers in the USA Computing Olympiad. He also holds bachelors and masters degrees in computer science from MIT and speaks fluent Japanese.
</p>');