[{"data":1,"prerenderedAt":1611},["ShallowReactive",2],{"navigation_docs":3,"-runtypes-drizzle-orm-row-level-security":399},[4,162,346],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":24},"RPC","icon-park-outline:lightning","\u002Frpc","01.rpc",[10,25,63,77,102,136],{"title":11,"icon":12,"redirect":7,"path":13,"stem":14,"children":15,"page":24},"Introduction","icon-park-outline:home","\u002Frpc\u002Fintroduction","01.rpc\u002F01.introduction",[16,20],{"title":17,"path":18,"stem":19},"Quick Start","\u002Frpc\u002Fintroduction\u002Fquick-start","01.rpc\u002F01.introduction\u002F02.quick-start",{"title":21,"path":22,"stem":23},"Manual Install","\u002Frpc\u002Fintroduction\u002Fmanual-install","01.rpc\u002F01.introduction\u002F03.manual-install",false,{"title":26,"icon":27,"path":28,"stem":29,"children":30,"page":24},"Server","icon-park-outline:server","\u002Frpc\u002Fserver","01.rpc\u002F02.server",[31,35,39,43,47,51,55,59],{"title":32,"path":33,"stem":34},"Routes","\u002Frpc\u002Fserver\u002Froutes","01.rpc\u002F02.server\u002F01.routes",{"title":36,"path":37,"stem":38},"Middleware","\u002Frpc\u002Fserver\u002Fmiddleware","01.rpc\u002F02.server\u002F02.middleware",{"title":40,"path":41,"stem":42},"Call Context","\u002Frpc\u002Fserver\u002Fcall-context","01.rpc\u002F02.server\u002F03.call-context",{"title":44,"path":45,"stem":46},"Headers","\u002Frpc\u002Fserver\u002Fheaders","01.rpc\u002F02.server\u002F04.headers",{"title":48,"path":49,"stem":50},"Error Handling","\u002Frpc\u002Fserver\u002Ferror-handling","01.rpc\u002F02.server\u002F05.error-handling",{"title":52,"path":53,"stem":54},"Validation","\u002Frpc\u002Fserver\u002Fvalidation","01.rpc\u002F02.server\u002F06.validation",{"title":56,"path":57,"stem":58},"JSON Round Trip","\u002Frpc\u002Fserver\u002Fjson-round-trip","01.rpc\u002F02.server\u002F07.json-round-trip",{"title":60,"path":61,"stem":62},"Drizzle Tables","\u002Frpc\u002Fserver\u002Fdrizzle-tables","01.rpc\u002F02.server\u002F08.drizzle-tables",{"title":64,"icon":65,"path":66,"stem":67,"children":68,"page":24},"Middlewares","icon-park-outline:link-one","\u002Frpc\u002Fmiddlewares","01.rpc\u002F03.middlewares",[69,73],{"title":70,"path":71,"stem":72},"fetchMetadata","\u002Frpc\u002Fmiddlewares\u002Ffetch-metadata","01.rpc\u002F03.middlewares\u002F01.fetch-metadata",{"title":74,"path":75,"stem":76},"syncRoutes","\u002Frpc\u002Fmiddlewares\u002Fsync-routes","01.rpc\u002F03.middlewares\u002F02.sync-routes",{"title":78,"icon":79,"path":80,"stem":81,"children":82,"page":24},"Client","icon-park-outline:computer","\u002Frpc\u002Fclient","01.rpc\u002F04.client",[83,87,91,94,98],{"title":84,"path":85,"stem":86},"Client Overview","\u002Frpc\u002Fclient\u002Fclient-overview","01.rpc\u002F04.client\u002F00.client-overview",{"title":88,"path":89,"stem":90},"Client Middleware","\u002Frpc\u002Fclient\u002Fclient-middleware","01.rpc\u002F04.client\u002F01.client-middleware",{"title":48,"path":92,"stem":93},"\u002Frpc\u002Fclient\u002Ferror-handling","01.rpc\u002F04.client\u002F02.error-handling",{"title":95,"path":96,"stem":97},"Batch Requests","\u002Frpc\u002Fclient\u002Fbatch","01.rpc\u002F04.client\u002F03.batch",{"title":99,"path":100,"stem":101},"Cancellation & Timeouts","\u002Frpc\u002Fclient\u002Fcancellation-timeouts","01.rpc\u002F04.client\u002F04.cancellation-timeouts",{"title":103,"redirect":104,"icon":105,"path":106,"stem":107,"children":108,"page":24},"Platforms","\u002Frpc\u002Fplatforms\u002Fnode-js","icon-park-outline:play","\u002Frpc\u002Fplatforms","01.rpc\u002F06.platforms",[109,112,116,120,124,128,132],{"title":110,"path":104,"stem":111},"Node.js","01.rpc\u002F06.platforms\u002F01.node-js",{"title":113,"path":114,"stem":115},"Bun","\u002Frpc\u002Fplatforms\u002Fbun","01.rpc\u002F06.platforms\u002F02.bun",{"title":117,"path":118,"stem":119},"AWS Lambda","\u002Frpc\u002Fplatforms\u002Faws-lambda","01.rpc\u002F06.platforms\u002F03.aws-lambda",{"title":121,"path":122,"stem":123},"Google Cloud Functions","\u002Frpc\u002Fplatforms\u002Fgoogle-cloud-functions","01.rpc\u002F06.platforms\u002F04.google-cloud-functions",{"title":125,"path":126,"stem":127},"Cloudflare Workers","\u002Frpc\u002Fplatforms\u002Fcloudflare","01.rpc\u002F06.platforms\u002F05.cloudflare",{"title":129,"path":130,"stem":131},"Vercel","\u002Frpc\u002Fplatforms\u002Fvercel","01.rpc\u002F06.platforms\u002F06.vercel",{"title":133,"path":134,"stem":135},"uWebSockets.js","\u002Frpc\u002Fplatforms\u002Fuwebsockets","01.rpc\u002F06.platforms\u002F07.uwebsockets",{"title":137,"icon":138,"path":139,"stem":140,"children":141,"page":24},"Devtools","icon-park-outline:tool","\u002Frpc\u002Fdevtools","01.rpc\u002F07.devtools",[142,146,150,154,158],{"title":143,"path":144,"stem":145},"Linter","\u002Frpc\u002Fdevtools\u002Flinter","01.rpc\u002F07.devtools\u002F01.linter",{"title":147,"path":148,"stem":149},"Vite","\u002Frpc\u002Fdevtools\u002Fvite","01.rpc\u002F07.devtools\u002F02.vite",{"title":151,"path":152,"stem":153},"Next.js","\u002Frpc\u002Fdevtools\u002Fnextjs","01.rpc\u002F07.devtools\u002F03.nextjs",{"title":155,"path":156,"stem":157},"CLI","\u002Frpc\u002Fdevtools\u002Fcli","01.rpc\u002F07.devtools\u002F04.cli",{"title":159,"path":160,"stem":161},"API Types","\u002Frpc\u002Fdevtools\u002Fapi-types","01.rpc\u002F07.devtools\u002F05.api-types",{"title":163,"icon":164,"path":165,"stem":166,"children":167,"page":24},"RunTypes","i-lucide-braces","\u002Fruntypes","02.runtypes",[168,184,224,254,268,290,332],{"title":11,"icon":169,"redirect":165,"path":170,"stem":171,"children":172,"page":24},"i-lucide-rocket","\u002Fruntypes\u002Fintroduction","02.runtypes\u002F01.introduction",[173,177,180],{"title":174,"path":175,"stem":176},"Built on typescript-go","\u002Fruntypes\u002Fintroduction\u002Fbuilt-on-typescript-go","02.runtypes\u002F01.introduction\u002F02.built-on-typescript-go",{"title":17,"path":178,"stem":179},"\u002Fruntypes\u002Fintroduction\u002Fquick-start","02.runtypes\u002F01.introduction\u002F03.quick-start",{"title":181,"path":182,"stem":183},"Configuration","\u002Fruntypes\u002Fintroduction\u002Fconfiguration","02.runtypes\u002F01.introduction\u002F04.configuration",{"title":185,"icon":186,"redirect":187,"path":188,"stem":189,"children":190,"page":24},"Guide","i-lucide-book-open","\u002Fruntypes\u002Fguide\u002Ftype-builders","\u002Fruntypes\u002Fguide","02.runtypes\u002F02.guide",[191,194,198,201,204,208,212,216,220],{"title":192,"path":187,"stem":193},"Types vs Type Builders","02.runtypes\u002F02.guide\u002F01.type-builders",{"title":195,"path":196,"stem":197},"Reflection","\u002Fruntypes\u002Fguide\u002Freflection","02.runtypes\u002F02.guide\u002F02.reflection",{"title":52,"path":199,"stem":200},"\u002Fruntypes\u002Fguide\u002Fvalidation","02.runtypes\u002F02.guide\u002F03.validation",{"title":56,"path":202,"stem":203},"\u002Fruntypes\u002Fguide\u002Fjson-round-trip","02.runtypes\u002F02.guide\u002F04.json-round-trip",{"title":205,"path":206,"stem":207},"Data Mocking","\u002Fruntypes\u002Fguide\u002Fmocking","02.runtypes\u002F02.guide\u002F07.mocking",{"title":209,"path":210,"stem":211},"JSON Schemas","\u002Fruntypes\u002Fguide\u002Fjson-schemas","02.runtypes\u002F02.guide\u002F08.json-schemas",{"title":213,"path":214,"stem":215},"Pure Functions","\u002Fruntypes\u002Fguide\u002Fpure-functions","02.runtypes\u002F02.guide\u002F09.pure-functions",{"title":217,"path":218,"stem":219},"Compiler Markers","\u002Fruntypes\u002Fguide\u002Fcompiler-markers","02.runtypes\u002F02.guide\u002F10.compiler-markers",{"title":221,"path":222,"stem":223},"All Compiled Functions","\u002Fruntypes\u002Fguide\u002Fall-compiled-functions","02.runtypes\u002F02.guide\u002F11.all-compiled-functions",{"title":225,"icon":226,"redirect":227,"path":228,"stem":229,"children":230,"page":24},"Type Formats","i-lucide-shapes","\u002Fruntypes\u002Ftype-formats\u002Foverview","\u002Fruntypes\u002Ftype-formats","02.runtypes\u002F03.type-formats",[231,234,238,242,246,250],{"title":232,"path":227,"stem":233},"Overview","02.runtypes\u002F03.type-formats\u002F01.overview",{"title":235,"path":236,"stem":237},"String Formats","\u002Fruntypes\u002Ftype-formats\u002Fstring","02.runtypes\u002F03.type-formats\u002F02.string",{"title":239,"path":240,"stem":241},"Number Formats","\u002Fruntypes\u002Ftype-formats\u002Fnumber","02.runtypes\u002F03.type-formats\u002F03.number",{"title":243,"path":244,"stem":245},"BigInt Formats","\u002Fruntypes\u002Ftype-formats\u002Fbigint","02.runtypes\u002F03.type-formats\u002F04.bigint",{"title":247,"path":248,"stem":249},"Date and Time Formats","\u002Fruntypes\u002Ftype-formats\u002Fdate-time","02.runtypes\u002F03.type-formats\u002F05.date-time",{"title":251,"path":252,"stem":253},"Collection Formats","\u002Fruntypes\u002Ftype-formats\u002Fcollections","02.runtypes\u002F03.type-formats\u002F06.collections",{"title":255,"icon":256,"redirect":257,"path":258,"stem":259,"children":260,"page":24},"Tooling","i-lucide-wrench","\u002Fruntypes\u002Ftooling\u002Flinting","\u002Fruntypes\u002Ftooling","02.runtypes\u002F04.tooling",[261,264],{"title":262,"path":257,"stem":263},"Linting","02.runtypes\u002F04.tooling\u002F01.linting",{"title":265,"path":266,"stem":267},"Source Conversion","\u002Fruntypes\u002Ftooling\u002Fsource-conversion","02.runtypes\u002F04.tooling\u002F02.source-conversion",{"title":269,"icon":270,"redirect":271,"path":272,"stem":273,"children":274,"page":24},"AI Integration","i-lucide-sparkles","\u002Fruntypes\u002Fai-integration\u002Fworkflow-and-commands","\u002Fruntypes\u002Fai-integration","02.runtypes\u002F05.ai-integration",[275,278,282,286],{"title":276,"path":271,"stem":277},"AI Workflow","02.runtypes\u002F05.ai-integration\u002F01.workflow-and-commands",{"title":279,"path":280,"stem":281},"FriendlyText","\u002Fruntypes\u002Fai-integration\u002Ffriendly-text","02.runtypes\u002F05.ai-integration\u002F02.friendly-text",{"title":283,"path":284,"stem":285},"MockData","\u002Fruntypes\u002Fai-integration\u002Fmock-data","02.runtypes\u002F05.ai-integration\u002F03.mock-data",{"title":287,"path":288,"stem":289},"Translations (i18n)","\u002Fruntypes\u002Fai-integration\u002Fi18n","02.runtypes\u002F05.ai-integration\u002F04.i18n",{"title":291,"icon":292,"redirect":293,"path":294,"stem":295,"children":296,"page":24},"Drizzle ORM","i-lineicons-drizzle","\u002Fruntypes\u002Fdrizzle-orm\u002Fdrizzle-overview","\u002Fruntypes\u002Fdrizzle-orm","02.runtypes\u002F06.drizzle-orm",[297,300,304,308,312,316,320,324,328],{"title":298,"path":293,"stem":299},"Drizzle Overview","02.runtypes\u002F06.drizzle-orm\u002F00.drizzle-overview",{"title":301,"path":302,"stem":303},"Column Formats","\u002Fruntypes\u002Fdrizzle-orm\u002Fcolumn-formats","02.runtypes\u002F06.drizzle-orm\u002F01.column-formats",{"title":305,"path":306,"stem":307},"Views","\u002Fruntypes\u002Fdrizzle-orm\u002Fviews","02.runtypes\u002F06.drizzle-orm\u002F02.views",{"title":309,"path":310,"stem":311},"Indexes and Constraints","\u002Fruntypes\u002Fdrizzle-orm\u002Fconstraints","02.runtypes\u002F06.drizzle-orm\u002F03.constraints",{"title":313,"path":314,"stem":315},"Row Level Security","\u002Fruntypes\u002Fdrizzle-orm\u002Frow-level-security","02.runtypes\u002F06.drizzle-orm\u002F04.row-level-security",{"title":317,"path":318,"stem":319},"Relations","\u002Fruntypes\u002Fdrizzle-orm\u002Frelations","02.runtypes\u002F06.drizzle-orm\u002F05.relations",{"title":321,"path":322,"stem":323},"The Schema File","\u002Fruntypes\u002Fdrizzle-orm\u002Fschema-file","02.runtypes\u002F06.drizzle-orm\u002F06.schema-file",{"title":325,"path":326,"stem":327},"Migrate an Existing Schema","\u002Fruntypes\u002Fdrizzle-orm\u002Fmigrate-an-existing-schema","02.runtypes\u002F06.drizzle-orm\u002F07.migrate-an-existing-schema",{"title":329,"path":330,"stem":331},"Cloudflare D1 and Durable Objects","\u002Fruntypes\u002Fdrizzle-orm\u002Fcloudflare-storage","02.runtypes\u002F06.drizzle-orm\u002F08.cloudflare-storage",{"title":333,"icon":334,"redirect":335,"path":336,"stem":337,"children":338,"page":24},"Diagnostics","i-lucide-triangle-alert","\u002Fruntypes\u002Fdiagnostics\u002Ferror-levels","\u002Fruntypes\u002Fdiagnostics","02.runtypes\u002F08.diagnostics",[339,342],{"title":340,"path":335,"stem":341},"Error Levels","02.runtypes\u002F08.diagnostics\u002F01.error-levels",{"title":343,"path":344,"stem":345},"All Diagnostics","\u002Fruntypes\u002Fdiagnostics\u002Fall-diagnostics","02.runtypes\u002F08.diagnostics\u002F02.all-diagnostics",{"title":347,"icon":348,"path":349,"stem":350,"children":351,"page":24},"Benchmarks","i-lucide-gauge","\u002Fbenchmarks","03.benchmarks",[352,372],{"title":5,"icon":6,"redirect":353,"path":354,"stem":355,"children":356,"page":24},"\u002Fbenchmarks\u002Frpc\u002Fhello-world","\u002Fbenchmarks\u002Frpc","03.benchmarks\u002F02.rpc",[357,360,364,368],{"title":358,"path":353,"stem":359},"Hello World","03.benchmarks\u002F02.rpc\u002F01.hello-world",{"title":361,"path":362,"stem":363},"Light Validation","\u002Fbenchmarks\u002Frpc\u002Flight-validation","03.benchmarks\u002F02.rpc\u002F02.light-validation",{"title":365,"path":366,"stem":367},"Heavy Validation","\u002Fbenchmarks\u002Frpc\u002Fheavy-validation","03.benchmarks\u002F02.rpc\u002F03.heavy-validation",{"title":369,"path":370,"stem":371},"Payload Sizes","\u002Fbenchmarks\u002Frpc\u002Fpayload-sizes","03.benchmarks\u002F02.rpc\u002F04.payload-sizes",{"title":163,"icon":164,"redirect":373,"path":374,"stem":375,"children":376,"page":24},"\u002Fbenchmarks\u002Fruntypes\u002Fis-valid","\u002Fbenchmarks\u002Fruntypes","03.benchmarks\u002F03.runtypes",[377,380,384,388,392,395],{"title":378,"path":373,"stem":379},"Is Valid","03.benchmarks\u002F03.runtypes\u002F01.is-valid",{"title":381,"path":382,"stem":383},"Is Valid Formats","\u002Fbenchmarks\u002Fruntypes\u002Fis-valid-formats","03.benchmarks\u002F03.runtypes\u002F02.is-valid-formats",{"title":385,"path":386,"stem":387},"Get Errors","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors","03.benchmarks\u002F03.runtypes\u002F03.get-errors",{"title":389,"path":390,"stem":391},"Get Errors Formats","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors-formats","03.benchmarks\u002F03.runtypes\u002F04.get-errors-formats",{"title":56,"path":393,"stem":394},"\u002Fbenchmarks\u002Fruntypes\u002Fjson-round-trip","03.benchmarks\u002F03.runtypes\u002F05.json-round-trip",{"title":396,"path":397,"stem":398},"Type Checking","\u002Fbenchmarks\u002Fruntypes\u002Ftype-checking","03.benchmarks\u002F03.runtypes\u002F07.type-checking",{"id":400,"title":313,"body":401,"description":1605,"extension":1606,"links":1607,"meta":1608,"navigation":485,"path":314,"seo":1609,"stem":315,"__hash__":1610},"docs\u002F02.runtypes\u002F06.drizzle-orm\u002F04.row-level-security.md",{"type":402,"value":403,"toc":1599},"minimark",[404,408,1285,1290,1300,1370,1374,1395,1402,1471,1475,1481,1485,1500,1595],[405,406,407],"p",{},"Row level security is PostgreSQL only. drizzle-kit sees your roles and policies in your migrations, and your row types do not change.",[409,410,415],"pre",{"className":411,"code":412,"language":413,"meta":414,"style":414},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import * as DZ from '@mionjs\u002Fdrizzle-orm-pg-core';\nimport {sql} from '@mionjs\u002Fdrizzle-orm';\n\nexport const appUser = DZ.pgRole('app_user', {\n  createDb: false,\n  createRole: false,\n  inherit: true,\n});\n\n\u002F\u002F a managed role from your provider, say\nexport const authenticated = DZ.pgRole('authenticated').existing();\n\nexport const documents = DZ.pgTable(\n  'documents',\n  {\n    id: DZ.uuid('id', {defaultRandom: true, primaryKey: true}),\n    ownerId: DZ.uuid('owner_id', {notNull: true}),\n    title: DZ.varchar('title', {length: 200, notNull: true}),\n    body: DZ.text('body'),\n  },\n  (t) => [\n    DZ.index('documents_owner_idx').on(t.ownerId),\n    DZ.pgPolicy('documents_owner_reads', {\n      as: 'permissive',\n      for: 'select',\n      to: authenticated,\n      using: sql`${t.ownerId} = current_setting('app.user_id')::uuid`,\n    }),\n    DZ.pgPolicy('documents_owner_writes', {\n      as: 'permissive',\n      for: 'insert',\n      to: appUser,\n      withCheck: sql`${t.ownerId} = current_setting('app.user_id')::uuid`,\n    }),\n  ]\n).enableRLS();\n\n\u002F\u002F needs its own toDrizzle call in the schema file\nexport const adminReadsEverything = DZ.pgPolicy('documents_admin_reads', {\n  for: 'select',\n  to: 'postgres',\n  using: sql`true`,\n}).link(documents);\n\n\u002F\u002F @ts-expect-error RLS is already enabled on this table\nexport const doubleEnabled = documents.enableRLS();\n","ts","",[416,417,418,454,480,487,529,546,558,571,581,586,593,632,637,659,672,678,728,768,820,848,854,872,909,932,949,966,979,1010,1020,1042,1057,1073,1085,1111,1120,1126,1140,1145,1151,1182,1198,1215,1234,1251,1256,1262],"code",{"__ignoreMap":414},[419,420,423,427,431,434,438,441,444,448,451],"span",{"class":421,"line":422},"line",1,[419,424,426],{"class":425},"s7zQu","import",[419,428,430],{"class":429},"sMK4o"," *",[419,432,433],{"class":425}," as",[419,435,437],{"class":436},"sTEyZ"," DZ ",[419,439,440],{"class":425},"from",[419,442,443],{"class":429}," '",[419,445,447],{"class":446},"sfazB","@mionjs\u002Fdrizzle-orm-pg-core",[419,449,450],{"class":429},"'",[419,452,453],{"class":429},";\n",[419,455,457,459,462,465,468,471,473,476,478],{"class":421,"line":456},2,[419,458,426],{"class":425},[419,460,461],{"class":429}," {",[419,463,464],{"class":436},"sql",[419,466,467],{"class":429},"}",[419,469,470],{"class":425}," from",[419,472,443],{"class":429},[419,474,475],{"class":446},"@mionjs\u002Fdrizzle-orm",[419,477,450],{"class":429},[419,479,453],{"class":429},[419,481,483],{"class":421,"line":482},3,[419,484,486],{"emptyLinePlaceholder":485},true,"\n",[419,488,490,493,497,500,503,506,509,513,516,518,521,523,526],{"class":421,"line":489},4,[419,491,492],{"class":425},"export",[419,494,496],{"class":495},"spNyl"," const",[419,498,499],{"class":436}," appUser ",[419,501,502],{"class":429},"=",[419,504,505],{"class":436}," DZ",[419,507,508],{"class":429},".",[419,510,512],{"class":511},"s2Zo4","pgRole",[419,514,515],{"class":436},"(",[419,517,450],{"class":429},[419,519,520],{"class":446},"app_user",[419,522,450],{"class":429},[419,524,525],{"class":429},",",[419,527,528],{"class":429}," {\n",[419,530,532,536,539,543],{"class":421,"line":531},5,[419,533,535],{"class":534},"swJcz","  createDb",[419,537,538],{"class":429},":",[419,540,542],{"class":541},"sfNiH"," false",[419,544,545],{"class":429},",\n",[419,547,549,552,554,556],{"class":421,"line":548},6,[419,550,551],{"class":534},"  createRole",[419,553,538],{"class":429},[419,555,542],{"class":541},[419,557,545],{"class":429},[419,559,561,564,566,569],{"class":421,"line":560},7,[419,562,563],{"class":534},"  inherit",[419,565,538],{"class":429},[419,567,568],{"class":541}," true",[419,570,545],{"class":429},[419,572,574,576,579],{"class":421,"line":573},8,[419,575,467],{"class":429},[419,577,578],{"class":436},")",[419,580,453],{"class":429},[419,582,584],{"class":421,"line":583},9,[419,585,486],{"emptyLinePlaceholder":485},[419,587,589],{"class":421,"line":588},10,[419,590,592],{"class":591},"sHwdD","\u002F\u002F a managed role from your provider, say\n",[419,594,596,598,600,603,605,607,609,611,613,615,618,620,622,624,627,630],{"class":421,"line":595},11,[419,597,492],{"class":425},[419,599,496],{"class":495},[419,601,602],{"class":436}," authenticated ",[419,604,502],{"class":429},[419,606,505],{"class":436},[419,608,508],{"class":429},[419,610,512],{"class":511},[419,612,515],{"class":436},[419,614,450],{"class":429},[419,616,617],{"class":446},"authenticated",[419,619,450],{"class":429},[419,621,578],{"class":436},[419,623,508],{"class":429},[419,625,626],{"class":511},"existing",[419,628,629],{"class":436},"()",[419,631,453],{"class":429},[419,633,635],{"class":421,"line":634},12,[419,636,486],{"emptyLinePlaceholder":485},[419,638,640,642,644,647,649,651,653,656],{"class":421,"line":639},13,[419,641,492],{"class":425},[419,643,496],{"class":495},[419,645,646],{"class":436}," documents ",[419,648,502],{"class":429},[419,650,505],{"class":436},[419,652,508],{"class":429},[419,654,655],{"class":511},"pgTable",[419,657,658],{"class":436},"(\n",[419,660,662,665,668,670],{"class":421,"line":661},14,[419,663,664],{"class":429},"  '",[419,666,667],{"class":446},"documents",[419,669,450],{"class":429},[419,671,545],{"class":429},[419,673,675],{"class":421,"line":674},15,[419,676,677],{"class":429},"  {\n",[419,679,681,684,686,688,690,693,695,697,700,702,704,706,709,711,713,715,718,720,722,724,726],{"class":421,"line":680},16,[419,682,683],{"class":534},"    id",[419,685,538],{"class":429},[419,687,505],{"class":436},[419,689,508],{"class":429},[419,691,692],{"class":511},"uuid",[419,694,515],{"class":436},[419,696,450],{"class":429},[419,698,699],{"class":446},"id",[419,701,450],{"class":429},[419,703,525],{"class":429},[419,705,461],{"class":429},[419,707,708],{"class":534},"defaultRandom",[419,710,538],{"class":429},[419,712,568],{"class":541},[419,714,525],{"class":429},[419,716,717],{"class":534}," primaryKey",[419,719,538],{"class":429},[419,721,568],{"class":541},[419,723,467],{"class":429},[419,725,578],{"class":436},[419,727,545],{"class":429},[419,729,731,734,736,738,740,742,744,746,749,751,753,755,758,760,762,764,766],{"class":421,"line":730},17,[419,732,733],{"class":534},"    ownerId",[419,735,538],{"class":429},[419,737,505],{"class":436},[419,739,508],{"class":429},[419,741,692],{"class":511},[419,743,515],{"class":436},[419,745,450],{"class":429},[419,747,748],{"class":446},"owner_id",[419,750,450],{"class":429},[419,752,525],{"class":429},[419,754,461],{"class":429},[419,756,757],{"class":534},"notNull",[419,759,538],{"class":429},[419,761,568],{"class":541},[419,763,467],{"class":429},[419,765,578],{"class":436},[419,767,545],{"class":429},[419,769,771,774,776,778,780,783,785,787,790,792,794,796,799,801,805,807,810,812,814,816,818],{"class":421,"line":770},18,[419,772,773],{"class":534},"    title",[419,775,538],{"class":429},[419,777,505],{"class":436},[419,779,508],{"class":429},[419,781,782],{"class":511},"varchar",[419,784,515],{"class":436},[419,786,450],{"class":429},[419,788,789],{"class":446},"title",[419,791,450],{"class":429},[419,793,525],{"class":429},[419,795,461],{"class":429},[419,797,798],{"class":534},"length",[419,800,538],{"class":429},[419,802,804],{"class":803},"sbssI"," 200",[419,806,525],{"class":429},[419,808,809],{"class":534}," notNull",[419,811,538],{"class":429},[419,813,568],{"class":541},[419,815,467],{"class":429},[419,817,578],{"class":436},[419,819,545],{"class":429},[419,821,823,826,828,830,832,835,837,839,842,844,846],{"class":421,"line":822},19,[419,824,825],{"class":534},"    body",[419,827,538],{"class":429},[419,829,505],{"class":436},[419,831,508],{"class":429},[419,833,834],{"class":511},"text",[419,836,515],{"class":436},[419,838,450],{"class":429},[419,840,841],{"class":446},"body",[419,843,450],{"class":429},[419,845,578],{"class":436},[419,847,545],{"class":429},[419,849,851],{"class":421,"line":850},20,[419,852,853],{"class":429},"  },\n",[419,855,857,860,864,866,869],{"class":421,"line":856},21,[419,858,859],{"class":429},"  (",[419,861,863],{"class":862},"sHdIc","t",[419,865,578],{"class":429},[419,867,868],{"class":495}," =>",[419,870,871],{"class":436}," [\n",[419,873,875,878,880,883,885,887,890,892,894,896,899,902,904,907],{"class":421,"line":874},22,[419,876,877],{"class":436},"    DZ",[419,879,508],{"class":429},[419,881,882],{"class":511},"index",[419,884,515],{"class":436},[419,886,450],{"class":429},[419,888,889],{"class":446},"documents_owner_idx",[419,891,450],{"class":429},[419,893,578],{"class":436},[419,895,508],{"class":429},[419,897,898],{"class":511},"on",[419,900,901],{"class":436},"(t",[419,903,508],{"class":429},[419,905,906],{"class":436},"ownerId)",[419,908,545],{"class":429},[419,910,912,914,916,919,921,923,926,928,930],{"class":421,"line":911},23,[419,913,877],{"class":436},[419,915,508],{"class":429},[419,917,918],{"class":511},"pgPolicy",[419,920,515],{"class":436},[419,922,450],{"class":429},[419,924,925],{"class":446},"documents_owner_reads",[419,927,450],{"class":429},[419,929,525],{"class":429},[419,931,528],{"class":429},[419,933,935,938,940,942,945,947],{"class":421,"line":934},24,[419,936,937],{"class":534},"      as",[419,939,538],{"class":429},[419,941,443],{"class":429},[419,943,944],{"class":446},"permissive",[419,946,450],{"class":429},[419,948,545],{"class":429},[419,950,952,955,957,959,962,964],{"class":421,"line":951},25,[419,953,954],{"class":534},"      for",[419,956,538],{"class":429},[419,958,443],{"class":429},[419,960,961],{"class":446},"select",[419,963,450],{"class":429},[419,965,545],{"class":429},[419,967,969,972,974,977],{"class":421,"line":968},26,[419,970,971],{"class":534},"      to",[419,973,538],{"class":429},[419,975,976],{"class":436}," authenticated",[419,978,545],{"class":429},[419,980,982,985,987,990,993,995,997,1000,1002,1005,1008],{"class":421,"line":981},27,[419,983,984],{"class":534},"      using",[419,986,538],{"class":429},[419,988,989],{"class":511}," sql",[419,991,992],{"class":429},"`${",[419,994,863],{"class":436},[419,996,508],{"class":429},[419,998,999],{"class":436},"ownerId",[419,1001,467],{"class":429},[419,1003,1004],{"class":446}," = current_setting('app.user_id')::uuid",[419,1006,1007],{"class":429},"`",[419,1009,545],{"class":429},[419,1011,1013,1016,1018],{"class":421,"line":1012},28,[419,1014,1015],{"class":429},"    }",[419,1017,578],{"class":436},[419,1019,545],{"class":429},[419,1021,1023,1025,1027,1029,1031,1033,1036,1038,1040],{"class":421,"line":1022},29,[419,1024,877],{"class":436},[419,1026,508],{"class":429},[419,1028,918],{"class":511},[419,1030,515],{"class":436},[419,1032,450],{"class":429},[419,1034,1035],{"class":446},"documents_owner_writes",[419,1037,450],{"class":429},[419,1039,525],{"class":429},[419,1041,528],{"class":429},[419,1043,1045,1047,1049,1051,1053,1055],{"class":421,"line":1044},30,[419,1046,937],{"class":534},[419,1048,538],{"class":429},[419,1050,443],{"class":429},[419,1052,944],{"class":446},[419,1054,450],{"class":429},[419,1056,545],{"class":429},[419,1058,1060,1062,1064,1066,1069,1071],{"class":421,"line":1059},31,[419,1061,954],{"class":534},[419,1063,538],{"class":429},[419,1065,443],{"class":429},[419,1067,1068],{"class":446},"insert",[419,1070,450],{"class":429},[419,1072,545],{"class":429},[419,1074,1076,1078,1080,1083],{"class":421,"line":1075},32,[419,1077,971],{"class":534},[419,1079,538],{"class":429},[419,1081,1082],{"class":436}," appUser",[419,1084,545],{"class":429},[419,1086,1088,1091,1093,1095,1097,1099,1101,1103,1105,1107,1109],{"class":421,"line":1087},33,[419,1089,1090],{"class":534},"      withCheck",[419,1092,538],{"class":429},[419,1094,989],{"class":511},[419,1096,992],{"class":429},[419,1098,863],{"class":436},[419,1100,508],{"class":429},[419,1102,999],{"class":436},[419,1104,467],{"class":429},[419,1106,1004],{"class":446},[419,1108,1007],{"class":429},[419,1110,545],{"class":429},[419,1112,1114,1116,1118],{"class":421,"line":1113},34,[419,1115,1015],{"class":429},[419,1117,578],{"class":436},[419,1119,545],{"class":429},[419,1121,1123],{"class":421,"line":1122},35,[419,1124,1125],{"class":436},"  ]\n",[419,1127,1129,1131,1133,1136,1138],{"class":421,"line":1128},36,[419,1130,578],{"class":436},[419,1132,508],{"class":429},[419,1134,1135],{"class":511},"enableRLS",[419,1137,629],{"class":436},[419,1139,453],{"class":429},[419,1141,1143],{"class":421,"line":1142},37,[419,1144,486],{"emptyLinePlaceholder":485},[419,1146,1148],{"class":421,"line":1147},38,[419,1149,1150],{"class":591},"\u002F\u002F needs its own toDrizzle call in the schema file\n",[419,1152,1154,1156,1158,1161,1163,1165,1167,1169,1171,1173,1176,1178,1180],{"class":421,"line":1153},39,[419,1155,492],{"class":425},[419,1157,496],{"class":495},[419,1159,1160],{"class":436}," adminReadsEverything ",[419,1162,502],{"class":429},[419,1164,505],{"class":436},[419,1166,508],{"class":429},[419,1168,918],{"class":511},[419,1170,515],{"class":436},[419,1172,450],{"class":429},[419,1174,1175],{"class":446},"documents_admin_reads",[419,1177,450],{"class":429},[419,1179,525],{"class":429},[419,1181,528],{"class":429},[419,1183,1185,1188,1190,1192,1194,1196],{"class":421,"line":1184},40,[419,1186,1187],{"class":534},"  for",[419,1189,538],{"class":429},[419,1191,443],{"class":429},[419,1193,961],{"class":446},[419,1195,450],{"class":429},[419,1197,545],{"class":429},[419,1199,1201,1204,1206,1208,1211,1213],{"class":421,"line":1200},41,[419,1202,1203],{"class":534},"  to",[419,1205,538],{"class":429},[419,1207,443],{"class":429},[419,1209,1210],{"class":446},"postgres",[419,1212,450],{"class":429},[419,1214,545],{"class":429},[419,1216,1218,1221,1223,1225,1227,1230,1232],{"class":421,"line":1217},42,[419,1219,1220],{"class":534},"  using",[419,1222,538],{"class":429},[419,1224,989],{"class":511},[419,1226,1007],{"class":429},[419,1228,1229],{"class":446},"true",[419,1231,1007],{"class":429},[419,1233,545],{"class":429},[419,1235,1237,1239,1241,1243,1246,1249],{"class":421,"line":1236},43,[419,1238,467],{"class":429},[419,1240,578],{"class":436},[419,1242,508],{"class":429},[419,1244,1245],{"class":511},"link",[419,1247,1248],{"class":436},"(documents)",[419,1250,453],{"class":429},[419,1252,1254],{"class":421,"line":1253},44,[419,1255,486],{"emptyLinePlaceholder":485},[419,1257,1259],{"class":421,"line":1258},45,[419,1260,1261],{"class":591},"\u002F\u002F @ts-expect-error RLS is already enabled on this table\n",[419,1263,1265,1267,1269,1272,1274,1277,1279,1281,1283],{"class":421,"line":1264},46,[419,1266,492],{"class":425},[419,1268,496],{"class":495},[419,1270,1271],{"class":436}," doubleEnabled ",[419,1273,502],{"class":429},[419,1275,1276],{"class":436}," documents",[419,1278,508],{"class":429},[419,1280,1135],{"class":511},[419,1282,629],{"class":436},[419,1284,453],{"class":429},[1286,1287,1289],"h2",{"id":1288},"database-roles","Database Roles",[405,1291,1292,1295,1296,1299],{},[416,1293,1294],{},"pgRole(name, config)"," declares a role for drizzle-kit to create. ",[416,1297,1298],{},"existing()"," marks a role that is already there, so drizzle-kit leaves it alone:",[409,1301,1303],{"className":411,"code":1302,"language":413,"meta":414,"style":414},"const appUser = pgRole('app_user', {createRole: true});\nconst authenticated = pgRole('authenticated').existing();\n",[416,1304,1305,1342],{"__ignoreMap":414},[419,1306,1307,1310,1312,1314,1317,1319,1321,1323,1325,1327,1329,1332,1334,1336,1338,1340],{"class":421,"line":422},[419,1308,1309],{"class":495},"const",[419,1311,499],{"class":436},[419,1313,502],{"class":429},[419,1315,1316],{"class":511}," pgRole",[419,1318,515],{"class":436},[419,1320,450],{"class":429},[419,1322,520],{"class":446},[419,1324,450],{"class":429},[419,1326,525],{"class":429},[419,1328,461],{"class":429},[419,1330,1331],{"class":534},"createRole",[419,1333,538],{"class":429},[419,1335,568],{"class":541},[419,1337,467],{"class":429},[419,1339,578],{"class":436},[419,1341,453],{"class":429},[419,1343,1344,1346,1348,1350,1352,1354,1356,1358,1360,1362,1364,1366,1368],{"class":421,"line":456},[419,1345,1309],{"class":495},[419,1347,602],{"class":436},[419,1349,502],{"class":429},[419,1351,1316],{"class":511},[419,1353,515],{"class":436},[419,1355,450],{"class":429},[419,1357,617],{"class":446},[419,1359,450],{"class":429},[419,1361,578],{"class":436},[419,1363,508],{"class":429},[419,1365,626],{"class":511},[419,1367,629],{"class":436},[419,1369,453],{"class":429},[1286,1371,1373],{"id":1372},"security-policies","Security Policies",[405,1375,1376,1377,1380,1381,1380,1384,1380,1387,1390,1391,1394],{},"A policy declared in the table's third argument belongs to that table and comes with it. ",[416,1378,1379],{},"as",", ",[416,1382,1383],{},"for",[416,1385,1386],{},"to",[416,1388,1389],{},"using"," and ",[416,1392,1393],{},"withCheck"," are Drizzle's own options.",[405,1396,1397,1398,1401],{},"A policy declared apart and attached with ",[416,1399,1400],{},"link()"," belongs to no table, so export it and materialize it yourself, or your migrations will not see it:",[409,1403,1405],{"className":411,"code":1404,"language":413,"meta":414,"style":414},"export const adminReads = pgPolicy('admin_reads', {for: 'select', using: sql`true`}).link(documents);\n",[416,1406,1407],{"__ignoreMap":414},[419,1408,1409,1411,1413,1416,1418,1421,1423,1425,1428,1430,1432,1434,1436,1438,1440,1442,1444,1446,1449,1451,1453,1455,1457,1459,1461,1463,1465,1467,1469],{"class":421,"line":422},[419,1410,492],{"class":425},[419,1412,496],{"class":495},[419,1414,1415],{"class":436}," adminReads ",[419,1417,502],{"class":429},[419,1419,1420],{"class":511}," pgPolicy",[419,1422,515],{"class":436},[419,1424,450],{"class":429},[419,1426,1427],{"class":446},"admin_reads",[419,1429,450],{"class":429},[419,1431,525],{"class":429},[419,1433,461],{"class":429},[419,1435,1383],{"class":534},[419,1437,538],{"class":429},[419,1439,443],{"class":429},[419,1441,961],{"class":446},[419,1443,450],{"class":429},[419,1445,525],{"class":429},[419,1447,1448],{"class":534}," using",[419,1450,538],{"class":429},[419,1452,989],{"class":511},[419,1454,1007],{"class":429},[419,1456,1229],{"class":446},[419,1458,1007],{"class":429},[419,1460,467],{"class":429},[419,1462,578],{"class":436},[419,1464,508],{"class":429},[419,1466,1245],{"class":511},[419,1468,1248],{"class":436},[419,1470,453],{"class":429},[1286,1472,1474],{"id":1473},"enabling-row-level-security","Enabling Row Level Security",[405,1476,1477,1480],{},[416,1478,1479],{},"enableRLS()"," turns row level security on for a table. You can call it only once: the type it returns drops the method, as in Drizzle.",[1286,1482,1484],{"id":1483},"provider-policy-helpers","Provider Policy Helpers",[405,1486,1487,1488,1491,1492,1495,1496,1499],{},"Helpers like ",[416,1489,1490],{},"crudPolicy"," from ",[416,1493,1494],{},"drizzle-orm\u002Fneon",", and the predefined roles in ",[416,1497,1498],{},"drizzle-orm\u002Fsupabase",", are not wrapped here. Import them from Drizzle and put the result in the array as is:",[409,1501,1503],{"className":411,"code":1502,"language":413,"meta":414,"style":414},"import {crudPolicy} from 'drizzle-orm\u002Fneon';\n\npgTable('docs', {...}, () => [crudPolicy({role: admin, read: true, modify: false})]);\n",[416,1504,1505,1525,1529],{"__ignoreMap":414},[419,1506,1507,1509,1511,1513,1515,1517,1519,1521,1523],{"class":421,"line":422},[419,1508,426],{"class":425},[419,1510,461],{"class":429},[419,1512,1490],{"class":436},[419,1514,467],{"class":429},[419,1516,470],{"class":425},[419,1518,443],{"class":429},[419,1520,1494],{"class":446},[419,1522,450],{"class":429},[419,1524,453],{"class":429},[419,1526,1527],{"class":421,"line":456},[419,1528,486],{"emptyLinePlaceholder":485},[419,1530,1531,1533,1535,1537,1540,1542,1544,1547,1550,1552,1555,1557,1559,1562,1565,1567,1570,1572,1575,1577,1579,1581,1584,1586,1588,1590,1593],{"class":421,"line":482},[419,1532,655],{"class":511},[419,1534,515],{"class":436},[419,1536,450],{"class":429},[419,1538,1539],{"class":446},"docs",[419,1541,450],{"class":429},[419,1543,525],{"class":429},[419,1545,1546],{"class":429}," {...},",[419,1548,1549],{"class":429}," ()",[419,1551,868],{"class":495},[419,1553,1554],{"class":436}," [",[419,1556,1490],{"class":511},[419,1558,515],{"class":436},[419,1560,1561],{"class":429},"{",[419,1563,1564],{"class":534},"role",[419,1566,538],{"class":429},[419,1568,1569],{"class":436}," admin",[419,1571,525],{"class":429},[419,1573,1574],{"class":534}," read",[419,1576,538],{"class":429},[419,1578,568],{"class":541},[419,1580,525],{"class":429},[419,1582,1583],{"class":534}," modify",[419,1585,538],{"class":429},[419,1587,542],{"class":541},[419,1589,467],{"class":429},[419,1591,1592],{"class":436},")])",[419,1594,453],{"class":429},[1596,1597,1598],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":414,"searchDepth":456,"depth":456,"links":1600},[1601,1602,1603,1604],{"id":1288,"depth":456,"text":1289},{"id":1372,"depth":456,"text":1373},{"id":1473,"depth":456,"text":1474},{"id":1483,"depth":456,"text":1484},"Roles, policies and enableRLS on PostgreSQL tables, recorded for your migrations.","md",null,{},{"title":313,"description":1605},"qmQBVePnVNrxp5aKSxy9wLvNRLdHFFZjsDewkxC720Y",1793324366325]