From 63bca12f873c2e0bf3ffcc3133079760f09be343 Mon Sep 17 00:00:00 2001 From: Sasha <64744993+r1tsuu@users.noreply.github.com> Date: Mon, 30 Dec 2024 18:03:46 +0200 Subject: [PATCH] docs: fix docs for generate db schema (#10251) --- docs/database/postgres.mdx | 18 ++++++++++-------- docs/database/sqlite.mdx | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/database/postgres.mdx b/docs/database/postgres.mdx index d603814630..0501d0ad92 100644 --- a/docs/database/postgres.mdx +++ b/docs/database/postgres.mdx @@ -260,24 +260,26 @@ postgresAdapter({ beforeSchemaInit: [ ({ schema, adapter }) => { // Add a new table - schema.rawTables.myTable = { + adapter.rawTables.myTable = { name: 'my_table', - columns: [{ - name: 'my_id', - type: 'serial', - primaryKey: true - }], + columns: { + my_id: { + name: 'my_id', + type: 'serial', + primaryKey: true + } + } } // Add a new column to generated by Payload table: - schema.rawTables.posts.columns.customColumn = { + adapter.rawTables.posts.columns.customColumn = { name: 'custom_column', // Note that Payload SQL doesn't support everything that Drizzle does. type: 'integer', notNull: true } // Add a new index to generated by Payload table: - schema.rawTables.posts.indexes.customColumnIdx = { + adapter.rawTables.posts.indexes.customColumnIdx = { name: 'custom_column_idx', unique: true, on: ['custom_column'] diff --git a/docs/database/sqlite.mdx b/docs/database/sqlite.mdx index 18c4e9576d..cf1b3a3386 100644 --- a/docs/database/sqlite.mdx +++ b/docs/database/sqlite.mdx @@ -237,24 +237,26 @@ sqliteAdapter({ beforeSchemaInit: [ ({ schema, adapter }) => { // Add a new table - schema.rawTables.myTable = { + adapter.rawTables.myTable = { name: 'my_table', - columns: [{ - name: 'my_id', - type: 'integer', - primaryKey: true - }], + columns: { + my_id: { + name: 'my_id', + type: 'integer', + primaryKey: true + } + } } // Add a new column to generated by Payload table: - schema.rawTables.posts.columns.customColumn = { + adapter.rawTables.posts.columns.customColumn = { name: 'custom_column', // Note that Payload SQL doesn't support everything that Drizzle does. type: 'integer', notNull: true } // Add a new index to generated by Payload table: - schema.rawTables.posts.indexes.customColumnIdx = { + adapter.rawTables.posts.indexes.customColumnIdx = { name: 'custom_column_idx', unique: true, on: ['custom_column']