@amplication/plugin-db-mongo

1.4.11 • Public • Published

@amplication/plugin-db-mongo

NPM Downloads

Use a Mongo DB database in the service generated by Amplication.

Purpose

This plugin adds the required code to use Mongo database in the service generated by Amplication. It updates the following parts:

  • Updates the datasource on the schema.prisma file:
    • For versions older than 1.3.3 the datesource name is based on the database type
      • MongoDB - the datasource name is mongo
    • From version 1.3.3 the datasource name is db, no matter what is the database type
  • From version 1.3.3 as the datasouce name is db, all the custom attributes that use the @{datasource.name}.{nameOfTheAttribute} are replaced with @db.{nameOfTheAttribute}
  • Adds the requires services and variables to docker-compose.yml
  • Add the db service to the docker-compose.dev.yml
  • Add the requires environment variables to .env
  • Update package json file in order to support only the relevant prisma mongo commands
  • Change prisma schema fields according to the prisma mongo conventions

Configuration

The plugin uses the parameters configured on the database tab on the service settings page

image

Usage

This plugin integrates with the all default tasks and scripts used by the generated service:

    "seed": "ts-node scripts/seed.ts",
    "db:clean": "ts-node scripts/clean.ts",
    "prisma:generate": "prisma generate",
    "prisma:init": "prisma init",
    "prisma:pull":"prisma db pull",
    "prisma:push":" prisma db push",
    "docker:db": "docker-compose -f docker-compose.db.yml up -d",
    "docker:build": "docker build .",
    "compose:up": "docker-compose up -d",
    "compose:down": "docker-compose down --volumes"

Readme

Keywords

none

Package Sidebar

Install

npm i @amplication/plugin-db-mongo

Weekly Downloads

180,471

Version

1.4.11

License

Apache-2.0

Unpacked Size

208 kB

Total Files

19

Last publish

Collaborators

  • amplication-bot
  • mulygottlieb
  • levivannoort
  • overbit
  • morhag
  • amitbarletz
  • yuvalhazaz