Skip to content

Commit

Permalink
chore: cleanup migrate links and docs (#4813)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolg42 committed Dec 30, 2020
1 parent 650cfcc commit 0e4f86c
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 37 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -50,7 +50,7 @@ Note for Windows: Use the latest version of [Git Bash](https://gitforwindows.org
1. `cd fixtures/blog`
1. `export DB_URL=YOUR_POSTGRES_DB_URL`
For this step you might find our [docker-compose setup](./src/docker) helpful
1. `npx @prisma/cli migrate save --create-db --name init --experimental && npx @prisma/cli migrate up --experimental`
1. `npx @prisma/cli db push --preview-feature`
1. `ts-node main`

### Integration tests
Expand Down
30 changes: 14 additions & 16 deletions README.md
Expand Up @@ -30,8 +30,8 @@

Prisma is a **database toolkit** that consists of these tools:

- [**Prisma Client**](https://github.com/prisma/prisma-client-js): Auto-generated and type-safe query builder for Node.js & TypeScript
- [**Prisma Migrate**](https://github.com/prisma/migrate) (_experimental_): Declarative data modeling & migration system
- [**Prisma Client**](https://www.prisma.io/docs/concepts/components/prisma-client): Auto-generated and type-safe query builder for Node.js & TypeScript
- [**Prisma Migrate**](https://www.prisma.io/docs/concepts/components/prisma-migrate): Declarative data modeling & migration system
- [**Prisma Studio**](https://github.com/prisma/studio): GUI to view and edit data in your database

Prisma Client can be used in _any_ Node.js or TypeScript backend application (including serverless applications and microservices). This can be a [REST API](https://www.prisma.io/docs/understand-prisma/prisma-in-your-stack/rest), a [GraphQL API](https://www.prisma.io/docs/understand-prisma/prisma-in-your-stack/graphql) a gRPC API or anything else that needs a database.
Expand All @@ -44,17 +44,16 @@ The fastest way to get started with Prisma is by following the [**Quickstart (5

The Quickstart is based on a preconfigured SQLite database. You can also get started with your own database (PostgreSQL and MySQL) by following one of these guides:

- [Add Prisma to an existing project](https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project)
- [Setup a new project with Prisma from scratch (SQL migrations + introspection)](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch-sql)
- [Setup a new project with Prisma from scratch (Prisma Migrate)](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch-prisma-migrate)
- [Add Prisma to an existing project](https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project-typescript-postgres)
- [Setup a new project with Prisma from scratch (Prisma Migrate)](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch-typescript-postgres)

## How does Prisma work

This section provides a high-level overview of how Prisma works and its most important technical components. For a more thorough introduction, visit the [Prisma documentation](https://www.prisma.io/docs/).

### The Prisma schema

Every project that uses a tool from the Prisma toolkit starts with a [Prisma schema file](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/prisma-schema-file). The Prisma schema allows developers to define their _application models_ in an intuitive data modeling language. It also contains the connection to a database and defines a _generator_:
Every project that uses a tool from the Prisma toolkit starts with a [Prisma schema file](https://www.prisma.io/docs/concepts/components/prisma-schema). The Prisma schema allows developers to define their _application models_ in an intuitive data modeling language. It also contains the connection to a database and defines a _generator_:

```prisma
datasource db {
Expand Down Expand Up @@ -97,7 +96,7 @@ On this page, the focus is on the data model. You can learn more about [Data sou

#### Functions of Prisma models

The data model is a collection of [models](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/data-model#defining-models). A model has two major functions:
The data model is a collection of [models](https://www.prisma.io/docs/concepts/components/prisma-schema/data-model#defining-models). A model has two major functions:

- Represent a table in the underlying database
- Provide the foundation for the queries in the Prisma Client API
Expand All @@ -106,10 +105,10 @@ The data model is a collection of [models](https://www.prisma.io/docs/reference/

There are two major workflows for "getting" a data model into your Prisma schema:

- Generate the data model from [introspecting](https://www.prisma.io/docs/reference/tools-and-interfaces/introspection) a database
- Manually writing the data model and mapping it to the database with [Prisma Migrate](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-migrate)
- Generate the data model from [introspecting](https://www.prisma.io/docs/concepts/components/introspection) a database
- Manually writing the data model and mapping it to the database with [Prisma Migrate](https://www.prisma.io/docs/concepts/components/prisma-migrate)

Once the data model is defined, you can [generate Prisma Client](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/generating-prisma-client) which will expose CRUD and more queries for the defined models. If you're using TypeScript, you'll get full type-safety for all queries (even when only retrieving the subsets of a model's fields).
Once the data model is defined, you can [generate Prisma Client](https://www.prisma.io/docs/concepts/components/prisma-client/generating-prisma-client) which will expose CRUD and more queries for the defined models. If you're using TypeScript, you'll get full type-safety for all queries (even when only retrieving the subsets of a model's fields).

---

Expand All @@ -131,7 +130,7 @@ After you change your data model, you'll need to manually re-generate Prisma Cli
prisma generate
```

Refer to the documentation for more information about ["generating the Prisma client"](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/generating-prisma-client).
Refer to the documentation for more information about ["generating the Prisma client"](https://www.prisma.io/docs/concepts/components/prisma-client/generating-prisma-client).

#### Using Prisma Client to send queries to your database

Expand All @@ -157,7 +156,7 @@ const prisma = new PrismaClient()

Now you can start sending queries via the generated Prisma Client API, here are few sample queries. Note that all Prisma Client queries return _plain old JavaScript objects_.

Learn more about the available operations in the [Prisma Client API reference](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/api) or watch this [demo video](https://www.youtube.com/watch?v=LggrE5kJ75I&list=PLn2e1F9Rfr6k9PnR_figWOcSHgc_erDr5&index=4) (2 min).
Learn more about the available operations in the [Prisma Client docs](https://www.prisma.io/docs/concepts/components/prisma-client) or watch this [demo video](https://www.youtube.com/watch?v=LggrE5kJ75I&list=PLn2e1F9Rfr6k9PnR_figWOcSHgc_erDr5&index=4) (2 min).

##### Retrieve all `User` records from the database

Expand Down Expand Up @@ -198,7 +197,7 @@ const user = await prisma.user.create({
name: 'Alice',
email: 'alice@prisma.io',
posts: {
create: { title: 'Join us for Prisma Day 2020' },
create: { title: 'Join us for Prisma Day 2021' },
},
},
})
Expand All @@ -216,7 +215,7 @@ const post = await prisma.post.update({

#### Usage with TypeScript

Note that when using TypeScript, the result of this query will be _statically typed_ so that you can't accidentally access a property that doesn't exist (and any typos are caught at compile-time). Learn more about leveraging Prisma Client's generated types on the [Advanced usage of generated types](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/advanced-usage-of-generated-types) page in the docs.
Note that when using TypeScript, the result of this query will be _statically typed_ so that you can't accidentally access a property that doesn't exist (and any typos are caught at compile-time). Learn more about leveraging Prisma Client's generated types on the [Advanced usage of generated types](https://www.prisma.io/docs/concepts/components/prisma-client/advanced-usage-of-generated-types) page in the docs.

## Community

Expand All @@ -236,7 +235,7 @@ You can ask questions and initiate [discussions](https://github.com/prisma/prism

### Create a bug report for Prisma

If you see an error message or run into an issue, please make sure to create a bug report! You can find best practices for creating bug reports (like including additional debugging output) in the [docs](https://www.prisma.io/docs/more/creating-bug-reports)).
If you see an error message or run into an issue, please make sure to create a bug report! You can find best practices for creating bug reports (like including additional debugging output) in the [docs](https://www.prisma.io/docs/about/creating-bug-reports).

👉 [**Create bug report**](https://github.com/prisma/prisma/issues/new?assignees=&labels=&template=bug_report.md&title=)

Expand All @@ -258,4 +257,3 @@ Refer to our [contribution guidelines](https://github.com/prisma/prisma/blob/mas
[![Build status](https://badge.buildkite.com/590e1981074b70961362481ad8319a831b44a38c5d468d6408.svg?branch=master)](https://buildkite.com/prisma/prisma2-test)
- E2E Tests Status:
[![Actions Status](https://github.com/prisma/prisma2-e2e-tests/workflows/test/badge.svg)](https://github.com/prisma/prisma2-e2e-tests/actions)

29 changes: 14 additions & 15 deletions src/packages/migrate/README.md
Expand Up @@ -9,11 +9,11 @@
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://www.prisma.io/docs/">Docs</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/data-model">Data model</a>
<a href="https://www.prisma.io/docs/concepts/components/prisma-schema/data-model">Data model</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://github.com/prisma/prisma-examples/tree/master/experimental">Examples</a>
<a href="https://github.com/prisma/prisma-examples/">Examples</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://www.prisma.io/blog">Blog</a>
<a href="https://www.prisma.io/blog/">Blog</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://slack.prisma.io/">Slack</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
Expand All @@ -22,23 +22,22 @@

<hr>

**Prisma Migrate** is a powerful database schema migration tool. It uses a **declarative [data modeling](https://www.prisma.io/docs/understand-prisma/data-modeling) syntax** to describe your database schema. Prisma Migrate also stores your **migration history** and easily lets you **revert and replay migrations**. When migrating your database with Prisma Migrate, you can run provide **before- and after-hooks** to execute scripts, e.g. to populate the database with required values during a migration.
**Prisma Migrate** is an imperative database schema migration tool that enables you to make changes to your database schema. Migrations are auto-generated based on the Prisma schema changes but are fully customizable.

> **WARNING**: Prisma Migrate is currently in an **experimental** state and therefore should not be used in production environments. Please help up improve Prisma Migrate by creating [issues](https://github.com/prisma/migrate/issues/new/choose) and sharing your [feedback](https://slack.prisma.io/) with us. You can also follow the [technical specification](https://github.com/prisma/specs) to get an overview of what is planned for Prisma Migrate.
> **WARNING**: Prisma Migrate is currently in an **preview**. There may be bugs and it's not recommended to use it in production environments.
> Please help us improve Prisma Migrate by creating [issues](https://github.com/prisma/prisma/issues/new/choose) and sharing your [feedback](https://slack.prisma.io/) with us.
## Documentation

You can find more info about Prisma Migrate in the [Prisma documentation](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch-prisma-migrate). Here are the most relevant pages from the docs:
You can find more info about Prisma Migrate in the [Prisma documentation](https://www.prisma.io/docs/concepts/components/prisma-migrate). Here are the most relevant pages from the docs:

- [Introduction to Prisma Migrate](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-migrate)
- [Setup a new project from scratch with Prisma Migrate](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch-prisma-migrate) (15 min)
- [Prisma schema file](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/prisma-schema-file)
- [Data model](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/data-model)
- [Models](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/models)
- [Relations](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/relations)
- [Prisma Migrate](https://www.prisma.io/docs/concepts/components/prisma-migrate)
- [Add Prisma Migrate to an existing project](https://www.prisma.io/docs/guides/prisma-guides/prisma-migrate-guides/add-prisma-migrate-to-a-project)
- [Setup a new project from scratch with Prisma Migrate](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch-typescript-postgres) (15 min)
- [Prisma schema](https://www.prisma.io/docs/concepts/components/prisma-schema)
- [Data model](https://www.prisma.io/docs/concepts/components/prisma-schema/data-model)
- [Relations](https://www.prisma.io/docs/concepts/components/prisma-schema/relations)

## Contributing

Read more about how to contribute to Prisma Migrate [here](https://github.com/prisma/migrate/blob/master/CONTRIBUTING.md).

[![Build status](https://badge.buildkite.com/9caba29c5511a465e0cbf0f6b2f62173145d3dd90cf56c4daf.svg)](https://buildkite.com/prisma/migrate)
Refer to our [contribution guidelines](https://github.com/prisma/prisma/blob/master/CONTRIBUTING.md) and [Code of Conduct for contributors](https://github.com/prisma/prisma/blob/master/CODE_OF_CONDUCT.md).
6 changes: 5 additions & 1 deletion src/packages/migrate/package.json
Expand Up @@ -3,8 +3,12 @@
"version": "2.11.0-dev.20",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "git@github.com:prisma/migrate.git",
"repository": "git@github.com:prisma/prisma.git",
"author": "Tim Suchanek <suchanek@prisma.io>",
"maintainers": [
"Tim Suchanek <suchanek@prisma.io>",
"Joël Galeran <galeran@prisma.io>"
],
"license": "Apache-2.0",
"prisma": {
"version": "latest"
Expand Down
2 changes: 1 addition & 1 deletion src/packages/migrate/src/MigrateEngine.ts
Expand Up @@ -419,5 +419,5 @@ function serializePanic(log): string {
Please create an issue in the ${chalk.bold('migrate')} repo with
your \`schema.prisma\` and the prisma command you tried to use 🙏:
${chalk.underline('https://github.com/prisma/migrate/issues/new')}\n`
${chalk.underline('https://github.com/prisma/prisma/issues/new')}\n`
}
Expand Up @@ -9,7 +9,7 @@ describe('getErrorMessageWithLink', () => {
})

expect(stripAnsi(message)).toMatchInlineSnapshot(
`https://github.com/prisma/migrate/issues/new?body=This+is+a+body&title=This+is+a+title&template=bug_report.md`,
`https://github.com/prisma/prisma/issues/new?body=This+is+a+body&title=This+is+a+title&template=bug_report.md`,
)
})
})
2 changes: 1 addition & 1 deletion src/packages/migrate/src/__tests__/handlePanic.test.ts
Expand Up @@ -163,7 +163,7 @@ describe('handlePanic', () => {
Please create an issue in the migrate repo with
your \`schema.prisma\` and the prisma command you tried to use 🙏:
https://github.com/prisma/migrate/issues/new
https://github.com/prisma/prisma/issues/new
`)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/migrate/src/utils/getGithubIssueUrl.ts
Expand Up @@ -6,7 +6,7 @@ import { getPlatform } from '@prisma/get-platform'
export function getGithubIssueUrl({
title,
user = 'prisma',
repo = 'migrate',
repo = 'prisma',
template = 'bug_report.md',
body,
}: {
Expand Down
4 changes: 4 additions & 0 deletions src/packages/sdk/package.json
Expand Up @@ -5,6 +5,10 @@
"types": "dist/index.d.ts",
"repository": "git@github.com:prisma/prisma.git",
"author": "Tim Suchanek <suchanek@prisma.io>",
"maintainers": [
"Tim Suchanek <suchanek@prisma.io>",
"Joël Galeran <galeran@prisma.io>"
],
"license": "Apache-2.0",
"scripts": {
"build": "tsc -d",
Expand Down

0 comments on commit 0e4f86c

Please sign in to comment.