Mottelz.com

Currently a developer blog.

Day 1: Database Setup

By Mottel Zirkind | December 21st, 2017

The project in a nontechnical nutshell: a website where writer’s login, post work for review and review others’ work. Posting work for review costs points which are accused from submitting reviews.

The stack: MySQL, Node, Express, and Handlebars.

I only have a few weeks to get the first version up and running so I’m using a stack I’ve used before. I started today with setting up the database and discovered how little I remember from the last time I looked at MySQL. I had to look up a lot of basic things, like how to make the unique id and how to setup a one to many relationship.

For now, I setup a local testing database using MAMP and configured it using the GUI offered by phpMyAdmin. Here’s an ERD of the database (generated using the Designer panel in phpMyAdmin):

The rest of this is going to be a breakdown of the database with one brief note at the end. So if you don’t want to hear anything else just jump to the last paragraph.

I’ve setup three tables writers, stories, and reviews. Writers doubles as users. This table only stores ID and name, because I plan on using a third party service for logins.

The stories table is going to hold everything written by users that can be reviewed. The plan is for users to submit everything from prose to scripts to poetry, which is why I setup a ‘type’ column.

The reviews table is for the reviews. Since the review author is differs from the story author this table references both the writers table (reviewer) and the stories table (story). The plan is to allow the people being reviewed to rate the helpfulness of the reviews out of 10.

As I write this, I’m realizing that there is going to be a difference between how things are referred to by users versus by me. Ratings are probably going to be called helpfulness. I’ll have to watch out for that in future updates.

The lesson I actually learned today is one that gets repeated all the time: “fail faster!” I’ve spent weeks thinking about this project without bothering to do anything and it’s all just wasted time I can’t get back. Instead, I’m going to try and set myself a small goal every weekday. Today it was build the database. I wonder what Sunday’s will be.

Prev | Day 1: Database Setup | Next

Up