Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Latest commit

History

History
53 lines (35 loc) 路 1.22 KB

File metadata and controls

53 lines (35 loc) 路 1.22 KB

import Warning from 'components/Markdown/Warning'

export const meta = { title: "prisma introspect", position: 140, }

$ prisma introspect

Creates a datamodel by introspecting the schema of an existing database.

prisma introspect currently only works for PostgreSQL and MongoDB databases.

Learn more about database introspection with Prisma here.

Usage

prisma introspect

Examples

Introspect an existing database

prisma introspect

Here is a sample interaction where the PostgreSQL database connection details are provided through the wizard:

? What kind of database do you want to introspect? Postgres
? Enter database host localhost
? Enter database port 5432
? Enter database user prisma
? Enter database password ****
? Enter name of existing database prisma-db
? Enter name of existing schema public

Introspecting database 402ms
Created datamodel mapping based on 7 database tables.

Created 1 new file:               

  datamodel-[TIMESTAMP].graphql    GraphQL SDL-based datamodel (derived from existing database)

The generated datamodel file will contain a timestamp in its name to avoid overriding your existing datamodel.prisma file.