From 3bda3db29d53f4538da746e7e8f6a89fd1ac7ab4 Mon Sep 17 00:00:00 2001 From: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> Date: Wed, 6 Aug 2025 15:28:22 +0600 Subject: [PATCH 1/2] feat: add migrations.seed to the config docs DC-4716 --- .../325-prisma-config-reference.mdx | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/content/200-orm/500-reference/325-prisma-config-reference.mdx b/content/200-orm/500-reference/325-prisma-config-reference.mdx index e1ef798153..849974fd64 100644 --- a/content/200-orm/500-reference/325-prisma-config-reference.mdx +++ b/content/200-orm/500-reference/325-prisma-config-reference.mdx @@ -76,6 +76,8 @@ export declare type PrismaConfig = { // Configuration for Prisma migrations. migrations?: { path: string; + seed: string; + initShadowDb: string; }; // Configuration for the database view entities. @@ -227,6 +229,34 @@ export default defineConfig({ Learn more about the [`externalTables` feature here](/orm/prisma-schema/data-model/externally-managed-tables). +### `migrations.path` + +The path to the directory where Prisma should store migration files, and look for them. + +| Property | Type | Required | Default | +| ----------------- | -------- | -------- | ------- | +| `migrations.path` | `string` | No | none | + +### `migrations.seed` + +This option allows you to define a script that Prisma runs to seed your database after running migrations or using the npx prisma db seed command. The string should be a command that can be executed in your terminal, such as with `node`, `ts-node`, or `tsx`. + +| Property | Type | Required | Default | +| ----------------- | -------- | -------- | ------- | +| `migrations.seed` | `string` | No | none | + +**Example:** + +```ts +import { defineConfig } from "prisma/config"; + +export default defineConfig({ + migrations: { + seed: `tsx db/seed.ts`, + }, +}); +``` + ### `migrations.initShadowDb` This option allows you to define SQL statements that Prisma runs on the **shadow database** before creating migrations. It is useful when working with [external managed tables](/orm/prisma-schema/data-model/externally-managed-tables), as Prisma needs to know about the structure of these tables to correctly generate migrations. @@ -257,14 +287,6 @@ export default defineConfig({ Learn more about the [`externalTables` feature here](/orm/prisma-schema/data-model/externally-managed-tables). -### `migrations.path` - -The path to the directory where Prisma should store migration files, and look for them. - -| Property | Type | Required | Default | -| ----------------- | -------- | -------- | ------- | -| `migrations.path` | `string` | No | none | - ### `views.path` The path to the directory where Prisma should look for the SQL view definitions. From 06dadf7cffad500dc496dfaf31a9bce2e62df5fe Mon Sep 17 00:00:00 2001 From: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> Date: Wed, 6 Aug 2025 15:28:59 +0600 Subject: [PATCH 2/2] fix: clear typos DC-4680 --- .../20-data-model/65-externally-managed-tables.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/200-orm/100-prisma-schema/20-data-model/65-externally-managed-tables.mdx b/content/200-orm/100-prisma-schema/20-data-model/65-externally-managed-tables.mdx index 083ef39b71..05851a8b33 100644 --- a/content/200-orm/100-prisma-schema/20-data-model/65-externally-managed-tables.mdx +++ b/content/200-orm/100-prisma-schema/20-data-model/65-externally-managed-tables.mdx @@ -30,7 +30,7 @@ Externally managed tables are frequently used in combination with [multi-schema] :::warning Prisma ORM will not verify that the structure of the tables in the database and the structures of the Prisma models actually match. On the one hand, it requires the developer to be thorough when updating the Prisma schema (the safest way to do it is by using `prisma db pull`). -On the other hand, this flexibility enables to only represent a part of the underlying table in the database (and e.g. not expose _all_ its columns). +On the other hand, this flexibility enables you to represent only part of the underlying table in the database (and e.g. not expose _all_ its columns). ::: ## Workflow @@ -71,8 +71,8 @@ export default defineConfig({ }) ``` -- Analoguous to tables, you can also have externally managed _enums_. -- On PostgreSQL and SQL server you have to specify the fully qualified table/enum name including the schema name. For example: `public.products` or `auth.users`. +- Analogous to tables, you can also have externally managed _enums_. +- On PostgreSQL and SQL Server you have to specify the fully qualified table/enum name including the schema name. For example: `public.products` or `auth.users`. - On MySQL and SQLite, you only have to specify the table name. ## Relationships @@ -159,7 +159,7 @@ CREATE TABLE posts ( id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, title VARCHAR(200) NOT NULL, - content TEXT, + content TEXT ); ```