Code Monkey home page Code Monkey logo

prisma-relational-seeding-example's Introduction

Getting started

This is a sample of how you can easily seed relational data using Prisma. This assumes that you've got a PostgreSQL database created and have some working knowledge of Prisma. If you are using a different SQL database other than PostgreSQL, see below for further instructions.

For more information on getting started, check out the official Prisma guide.

Installation

  • Run npm install or yarn install
  • Create a .env file in the root of the project. You can use the .env.example file as an example of what it should look like.
  • Inside of your .env file, point your DATABASE_URL variable to a fresh PostgreSQL database of your choice. NOTE: this will wipe out any existing data in the database you point to, so make sure you set up a fresh database for this example!

Using this with a different SQL database other than PostgreSQL

If you are using a different database other than PostgreSQL, modify the provider at the top of the prisma/schema.prisma file.

Running the seed

  • Use the command npm run seed or yarn seed

Viewing your seed data

  • Use the prisma studio command

Further reading

You for additional reading, you can check out my full blog post here.

prisma-relational-seeding-example's People

Contributors

jordan-mcrae avatar

Watchers

 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.