From 611eb0cc90598d38bdfd40447178d4ee8b6c6c01 Mon Sep 17 00:00:00 2001 From: igalklebanov Date: Mon, 2 Sep 2024 12:18:08 +0300 Subject: [PATCH] add missing json column @ Getting Started. --- site/docs/getting-started/Summary.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/site/docs/getting-started/Summary.tsx b/site/docs/getting-started/Summary.tsx index 6fed7f893..555c0869a 100644 --- a/site/docs/getting-started/Summary.tsx +++ b/site/docs/getting-started/Summary.tsx @@ -2,11 +2,7 @@ import Admonition from '@theme/Admonition' import CodeBlock from '@theme/CodeBlock' import Link from '@docusaurus/Link' import { IUseADifferentDatabase } from './IUseADifferentDatabase' -import { - PRETTY_DIALECT_NAMES, - type Dialect, - type PropsWithDialect, -} from './shared' +import { type Dialect, type PropsWithDialect } from './shared' const dialectSpecificCodeSnippets: Record = { postgresql: ` await db.schema.createTable('person') @@ -17,6 +13,7 @@ const dialectSpecificCodeSnippets: Record = { .addColumn('created_at', 'timestamp', (cb) => cb.notNull().defaultTo(sql\`now()\`) ) + .addColumn('metadata', 'jsonb', (cb) => cb.notNull()) .execute()`, mysql: ` await db.schema.createTable('person') .addColumn('id', 'integer', (cb) => cb.primaryKey().autoIncrement()) @@ -26,6 +23,7 @@ const dialectSpecificCodeSnippets: Record = { .addColumn('created_at', 'timestamp', (cb) => cb.notNull().defaultTo(sql\`now()\`) ) + .addColumn('metadata', 'json', (cb) => cb.notNull()) .execute()`, // TODO: Update line 42's IDENTITY once identity(1,1) is added to core. mssql: ` await db.schema.createTable('person') @@ -36,6 +34,7 @@ const dialectSpecificCodeSnippets: Record = { .addColumn('created_at', 'datetime', (cb) => cb.notNull().defaultTo(sql\`GETDATE()\`) ) + .addColumn('metadata', sql\`nvarchar(max)\`, (cb) => cb.notNull()) .execute()`, sqlite: ` await db.schema.createTable('person') .addColumn('id', 'integer', (cb) => cb.primaryKey().autoIncrement().notNull()) @@ -45,6 +44,7 @@ const dialectSpecificCodeSnippets: Record = { .addColumn('created_at', 'timestamp', (cb) => cb.notNull().defaultTo(sql\`current_timestamp\`) ) + .addColumn('metadata', 'text', (cb) => cb.notNull()) .execute()`, } @@ -107,6 +107,12 @@ ${dialectSpecificCodeSnippet} first_name: 'Jennifer', last_name: 'Aniston', gender: 'woman', + metadata: sql.valJson({ + login_at: new Date().toISOString(), + ip: null, + agent: null, + plan: 'free', + }), }) })