Prisma CLI & ConfigurationCLI Command Reference

prisma1 introspect

$ prisma1 introspect

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

Learn more about database introspection with Prisma here.

Usage

prisma1 introspect

Examples

Introspect an existing database

prisma1 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.