diff --git a/code-samples/eventing/bookstore-sample-app/db/README.md b/code-samples/eventing/bookstore-sample-app/db/README.md new file mode 100644 index 000000000..9fb745e87 --- /dev/null +++ b/code-samples/eventing/bookstore-sample-app/db/README.md @@ -0,0 +1,26 @@ +# Bookstore Database + +1. Database Schema +2. Sample Data + +## 1. Database Schema + +### BookReviews Table +The BookReviews table contains all reviews made on the bookstore website. + +See the columns of the BookReviews table below: +* ID (serial) - Primary Key +* post_time (datetime) - Posting time of the comment +* content (text) - The contents of the comment +* sentiment (text) - The sentiment results (currently, the values it could take on are 'positive' or 'neutral' or 'negative') + +## 2. Sample Data + +### BookReviews Table +The sample rows inserted for the BookReviews table are shown below: +| id | post_time | content | sentiment | +|----|---------------------|------------------------------|-----------| +| 1 | 2020-01-01 00:00:00 | This book is great! | positive | +| 2 | 2020-01-02 00:02:00 | This book is terrible! | negative | +| 3 | 2020-01-03 00:01:30 | This book is okay. | neutral | +| 4 | 2020-01-04 00:00:00 | Meh | neutral | \ No newline at end of file diff --git a/code-samples/eventing/bookstore-sample-app/db/sample.sql b/code-samples/eventing/bookstore-sample-app/db/sample.sql new file mode 100644 index 000000000..c690b0c7b --- /dev/null +++ b/code-samples/eventing/bookstore-sample-app/db/sample.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS book_reviews( + id SERIAL PRIMARY KEY, + post_time timestamp NOT NULL, + content TEXT NOT NULL, + sentiment TEXT, + CONSTRAINT sentiment_check CHECK (sentiment IN ('positive', 'negative', 'neutral')), +); + +INSERT INTO book_reviews (post_time, content, sentiment) VALUES + ('2020-01-01 00:00:00', 'This book is great!', 'positive'), + ('2020-01-02 00:02:00', 'This book is terrible!', 'negative'), + ('2020-01-03 00:01:30', 'This book is okay.', 'neutral'), + ('2020-01-04 00:00:00', 'Meh', 'neutral'); \ No newline at end of file