GithubHelp home page GithubHelp logo

blog-domain-challenge-1's Introduction

Blog Domain Challenge 1

Learning Objectives

  • Modify an incomplete entity relationship diagram to include relationships
  • Use an ORM to implement a database design
  • Use an ORM to create data in a database

Introduction

This challenge is an opportunity to practice everything we've learned about database design and ORM's. An incomplete entity relationship diagram has already been provided in the first requirement file; your task is to give the entities some appropriate fields and relationships, implement that design in Prisma and then populate the database with seed data.

Setting up

Note: Although we do need a new primary database for this exercise, we can reuse the shadow database created in the earlier exercise across as many new projects as we like. This is because prisma always resets it back to a fresh state after using it.

  1. Rename the .env.example file to .env. The .gitignore file ensures that .env won't be tracked in the repository, keeping sensitive data safe.
  2. Create a new database instance in ElephantSQL.
  3. Edit the DATABASE_URL variable in .env, swapping YOUR_DATABASE_URL for the URL of the database you just created. Leave ?schema=prisma at the end.
  4. Edit the SHADOW_DATABASE_URL variable in .env, swapping YOUR_SHADOW_DATABASE_URL for the URL of the shadow database you created in the previous exercise. Leave ?schema=shadow at the end. (Note that if you create a new instance for your shadow database, you will need to create the shadow schema too.)
  5. Run npm ci to install the project dependencies.
  6. Run npx prisma migrate reset to execute the existing migration & data seed. Press y when it asks if you're sure.

Instructions

  • Work through each requirement in the ./requirements/ directory in numeric order
  • Add an image of your complete entity relationship diagram to the root directory of this repository

Extension 1

Once you've completed every requirement, here are some additional challenges you should complete:

  1. Add a one-to-many self-relation to the Comment model to allow comments to have replies, and update the seed file to accomodate this change

blog-domain-challenge-1's People

Contributors

vherus avatar sigristarisa avatar mikemherron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.