Coder Social home page Coder Social logo

mts-shopdb-prisma's Introduction

MTS Shop Database with Prisma

Introduction

Welcome to the MTS Shop Database! This project uses Prisma as an Object-Relational Mapping (ORM) tool to interact with the database. It's designed to support the data needs of the MTS Shop application.

Prerequisites

Before you get started, make sure you have the following prerequisites installed:

  • Node.js
  • Prisma CLI
  • MySQL (or your preferred database system)

Installation

  1. Clone this repository to your local machine.
git clone https://github.com/pathan-mehedi/mts-shopDB-prisma.git
  1. Install the project dependencies.
cd mts-shopDB-prisma
npm install
  1. Configure your database connection in the schema.prisma file. Replace <your-database-name> with your actual database name (e.g., "mts_shopDB-prisma").
// schema.prisma
generator client {
  provider = "prisma-client-js"
  output   = "./node_modules/@prisma/client"
}

// ...

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL") // Replace with your database connection URL
}

// ...
  1. Generate the Prisma Client.
npx prisma generate

Usage

Now that you've set up the MTS Shop database with Prisma, you can use the Prisma Client to interact with your database. You can define models and create, read, update, or delete records.

You can run Prisma commands like:

  • npx prisma db push to apply database schema changes.
  • npx prisma generate to regenerate the Prisma Client.
  • Use the Prisma Client to perform database operations in your application.
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();

async function main() {
    // Your database operations here
    const user = await prisma.user.create({
        data: {
            name: "John Doe",
            email: "[email protected]",
        },
    });

    console.log("User created:", user);
}

main()
    .catch((e) => {
        throw e;
    })
    .finally(async () => {
        await prisma.$disconnect();
    });

License

This project is licensed under the MIT License. See the LICENSE file for details.

The README file now includes the updated repository link.

mts-shopdb-prisma's People

Contributors

pathan-mehedi 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.