[{"data":1,"prerenderedAt":1562},["ShallowReactive",2],{"navigation_docs":3,"-runtypes-drizzle-orm-migrate-an-existing-schema":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":325,"body":401,"description":1556,"extension":1557,"links":1558,"meta":1559,"navigation":522,"path":326,"seo":1560,"stem":327,"__hash__":1561},"docs\u002F02.runtypes\u002F06.drizzle-orm\u002F07.migrate-an-existing-schema.md",{"type":402,"value":403,"toc":1547},"minimark",[404,408,437,448,453,460,785,790,851,866,870,876,948,952,961,1110,1114,1117,1125,1169,1173,1179,1201,1453,1460,1471,1475,1481,1536,1540,1543],[405,406,407],"p",{},"One command rewrites tables you already wrote with Drizzle ORM onto the slim packages and leaves every query alone.",[409,410,415],"pre",{"className":411,"code":412,"language":413,"meta":414,"style":414},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","npx mion drizzle-migrate src\u002Fdb\u002Fschema.ts\n","bash","",[416,417,418],"code",{"__ignoreMap":414},[419,420,423,427,431,434],"span",{"class":421,"line":422},"line",1,[419,424,426],{"class":425},"sBMFI","npx",[419,428,430],{"class":429},"sfazB"," mion",[419,432,433],{"class":429}," drizzle-migrate",[419,435,436],{"class":429}," src\u002Fdb\u002Fschema.ts\n",[405,438,439,440,443,444,447],{},"Point it at a file or a whole directory. ",[416,441,442],{},"--check"," shows what it would change without writing anything, and ",[416,445,446],{},"--out-dir converted\u002F"," writes the result somewhere else (for a single directory only), leaving your sources untouched.",[449,450,452],"h2",{"id":451},"migrated-tables","Migrated Tables",[405,454,455,456,459],{},"Your table keeps its name. A second binding, with a ",[416,457,458],{},"$table"," suffix, holds the slim declaration:",[409,461,465],{"className":462,"code":463,"language":464,"meta":414,"style":414},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F before\nimport {pgTable, uuid, varchar} from 'drizzle-orm\u002Fpg-core';\n\nconst users = pgTable('users', {id: uuid().primaryKey(), name: varchar({length: 50}).notNull()});\n\n\u002F\u002F after\nimport {pgTable, uuid, varchar} from '@mionjs\u002Fdrizzle-orm-pg-core';\nimport {toDrizzle} from '@mionjs\u002Fdrizzle-orm-pg-core\u002Fdrizzle';\n\nconst users$table = pgTable('users', {id: uuid({primaryKey: true}), name: varchar({length: 50, notNull: true})});\nconst users = toDrizzle(users$table);\n","ts",[416,466,467,473,517,524,616,621,627,657,680,685,768],{"__ignoreMap":414},[419,468,469],{"class":421,"line":422},[419,470,472],{"class":471},"sHwdD","\u002F\u002F before\n",[419,474,476,480,484,488,491,494,496,499,502,505,508,511,514],{"class":421,"line":475},2,[419,477,479],{"class":478},"s7zQu","import",[419,481,483],{"class":482},"sMK4o"," {",[419,485,487],{"class":486},"sTEyZ","pgTable",[419,489,490],{"class":482},",",[419,492,493],{"class":486}," uuid",[419,495,490],{"class":482},[419,497,498],{"class":486}," varchar",[419,500,501],{"class":482},"}",[419,503,504],{"class":478}," from",[419,506,507],{"class":482}," '",[419,509,510],{"class":429},"drizzle-orm\u002Fpg-core",[419,512,513],{"class":482},"'",[419,515,516],{"class":482},";\n",[419,518,520],{"class":421,"line":519},3,[419,521,523],{"emptyLinePlaceholder":522},true,"\n",[419,525,527,531,534,537,541,544,546,549,551,553,555,559,562,564,567,570,573,575,577,580,582,584,586,589,592,594,598,600,603,605,608,610,612,614],{"class":421,"line":526},4,[419,528,530],{"class":529},"spNyl","const",[419,532,533],{"class":486}," users ",[419,535,536],{"class":482},"=",[419,538,540],{"class":539},"s2Zo4"," pgTable",[419,542,543],{"class":486},"(",[419,545,513],{"class":482},[419,547,548],{"class":429},"users",[419,550,513],{"class":482},[419,552,490],{"class":482},[419,554,483],{"class":482},[419,556,558],{"class":557},"swJcz","id",[419,560,561],{"class":482},":",[419,563,493],{"class":539},[419,565,566],{"class":486},"()",[419,568,569],{"class":482},".",[419,571,572],{"class":539},"primaryKey",[419,574,566],{"class":486},[419,576,490],{"class":482},[419,578,579],{"class":557}," name",[419,581,561],{"class":482},[419,583,498],{"class":539},[419,585,543],{"class":486},[419,587,588],{"class":482},"{",[419,590,591],{"class":557},"length",[419,593,561],{"class":482},[419,595,597],{"class":596},"sbssI"," 50",[419,599,501],{"class":482},[419,601,602],{"class":486},")",[419,604,569],{"class":482},[419,606,607],{"class":539},"notNull",[419,609,566],{"class":486},[419,611,501],{"class":482},[419,613,602],{"class":486},[419,615,516],{"class":482},[419,617,619],{"class":421,"line":618},5,[419,620,523],{"emptyLinePlaceholder":522},[419,622,624],{"class":421,"line":623},6,[419,625,626],{"class":471},"\u002F\u002F after\n",[419,628,630,632,634,636,638,640,642,644,646,648,650,653,655],{"class":421,"line":629},7,[419,631,479],{"class":478},[419,633,483],{"class":482},[419,635,487],{"class":486},[419,637,490],{"class":482},[419,639,493],{"class":486},[419,641,490],{"class":482},[419,643,498],{"class":486},[419,645,501],{"class":482},[419,647,504],{"class":478},[419,649,507],{"class":482},[419,651,652],{"class":429},"@mionjs\u002Fdrizzle-orm-pg-core",[419,654,513],{"class":482},[419,656,516],{"class":482},[419,658,660,662,664,667,669,671,673,676,678],{"class":421,"line":659},8,[419,661,479],{"class":478},[419,663,483],{"class":482},[419,665,666],{"class":486},"toDrizzle",[419,668,501],{"class":482},[419,670,504],{"class":478},[419,672,507],{"class":482},[419,674,675],{"class":429},"@mionjs\u002Fdrizzle-orm-pg-core\u002Fdrizzle",[419,677,513],{"class":482},[419,679,516],{"class":482},[419,681,683],{"class":421,"line":682},9,[419,684,523],{"emptyLinePlaceholder":522},[419,686,688,690,693,695,697,699,701,703,705,707,709,711,713,715,717,719,721,723,727,729,731,733,735,737,739,741,743,745,747,749,751,754,756,758,760,762,764,766],{"class":421,"line":687},10,[419,689,530],{"class":529},[419,691,692],{"class":486}," users$table ",[419,694,536],{"class":482},[419,696,540],{"class":539},[419,698,543],{"class":486},[419,700,513],{"class":482},[419,702,548],{"class":429},[419,704,513],{"class":482},[419,706,490],{"class":482},[419,708,483],{"class":482},[419,710,558],{"class":557},[419,712,561],{"class":482},[419,714,493],{"class":539},[419,716,543],{"class":486},[419,718,588],{"class":482},[419,720,572],{"class":557},[419,722,561],{"class":482},[419,724,726],{"class":725},"sfNiH"," true",[419,728,501],{"class":482},[419,730,602],{"class":486},[419,732,490],{"class":482},[419,734,579],{"class":557},[419,736,561],{"class":482},[419,738,498],{"class":539},[419,740,543],{"class":486},[419,742,588],{"class":482},[419,744,591],{"class":557},[419,746,561],{"class":482},[419,748,597],{"class":596},[419,750,490],{"class":482},[419,752,753],{"class":557}," notNull",[419,755,561],{"class":482},[419,757,726],{"class":725},[419,759,501],{"class":482},[419,761,602],{"class":486},[419,763,501],{"class":482},[419,765,602],{"class":486},[419,767,516],{"class":482},[419,769,771,773,775,777,780,783],{"class":421,"line":770},11,[419,772,530],{"class":529},[419,774,533],{"class":486},[419,776,536],{"class":482},[419,778,779],{"class":539}," toDrizzle",[419,781,782],{"class":486},"(users$table)",[419,784,516],{"class":482},[405,786,787,789],{},[416,788,548],{}," still holds the real Drizzle table, so every query, operator and config reader works with no edits:",[409,791,793],{"className":462,"code":792,"language":464,"meta":414,"style":414},"await db.select().from(users).where(eq(users.id, someId));\ngetTableConfig(users);\n",[416,794,795,842],{"__ignoreMap":414},[419,796,797,800,803,805,808,810,812,815,818,820,823,825,828,831,833,835,837,840],{"class":421,"line":422},[419,798,799],{"class":478},"await",[419,801,802],{"class":486}," db",[419,804,569],{"class":482},[419,806,807],{"class":539},"select",[419,809,566],{"class":486},[419,811,569],{"class":482},[419,813,814],{"class":539},"from",[419,816,817],{"class":486},"(users)",[419,819,569],{"class":482},[419,821,822],{"class":539},"where",[419,824,543],{"class":486},[419,826,827],{"class":539},"eq",[419,829,830],{"class":486},"(users",[419,832,569],{"class":482},[419,834,558],{"class":486},[419,836,490],{"class":482},[419,838,839],{"class":486}," someId))",[419,841,516],{"class":482},[419,843,844,847,849],{"class":421,"line":475},[419,845,846],{"class":539},"getTableConfig",[419,848,817],{"class":486},[419,850,516],{"class":482},[405,852,853,854,857,858,861,862,865],{},"Your models and routes take their types from ",[416,855,856],{},"users$table",". A view gets ",[416,859,860],{},"$view",", an enum ",[416,863,864],{},"$enum",", and so on for schemas, sequences, roles and policies.",[449,867,869],{"id":868},"import-changes","Import Changes",[405,871,872,873,561],{},"Column builders, tables, views, indexes and constraints move to the slim packages. Operators, config readers and everything on the query side stay on ",[416,874,875],{},"drizzle-orm",[409,877,879],{"className":462,"code":878,"language":464,"meta":414,"style":414},"import {alias, except, getTableConfig} from 'drizzle-orm\u002Fpg-core';\nimport {foreignKey, index, integer, text} from '@mionjs\u002Fdrizzle-orm-pg-core';\n",[416,880,881,912],{"__ignoreMap":414},[419,882,883,885,887,890,892,895,897,900,902,904,906,908,910],{"class":421,"line":422},[419,884,479],{"class":478},[419,886,483],{"class":482},[419,888,889],{"class":486},"alias",[419,891,490],{"class":482},[419,893,894],{"class":486}," except",[419,896,490],{"class":482},[419,898,899],{"class":486}," getTableConfig",[419,901,501],{"class":482},[419,903,504],{"class":478},[419,905,507],{"class":482},[419,907,510],{"class":429},[419,909,513],{"class":482},[419,911,516],{"class":482},[419,913,914,916,918,921,923,926,928,931,933,936,938,940,942,944,946],{"class":421,"line":475},[419,915,479],{"class":478},[419,917,483],{"class":482},[419,919,920],{"class":486},"foreignKey",[419,922,490],{"class":482},[419,924,925],{"class":486}," index",[419,927,490],{"class":482},[419,929,930],{"class":486}," integer",[419,932,490],{"class":482},[419,934,935],{"class":486}," text",[419,937,501],{"class":482},[419,939,504],{"class":478},[419,941,507],{"class":482},[419,943,652],{"class":429},[419,945,513],{"class":482},[419,947,516],{"class":482},[449,949,951],{"id":950},"two-sql-templates","Two SQL Templates",[405,953,954,957,958,561],{},[416,955,956],{},"sql"," lives on both sides: Drizzle's builds queries, and the slim one records a default or a check. Both are imported, the slim one as ",[416,959,960],{},"rtSql",[409,962,964],{"className":462,"code":963,"language":464,"meta":414,"style":414},"import {sql} from 'drizzle-orm';\nimport {sql as rtSql} from '@mionjs\u002Fdrizzle-orm';\n\nconst docs$table = pgTable('docs', {at: timestamp({default: [rtSql`now()`]})});\nawait db.execute(sql`select 1`);\n",[416,965,966,986,1013,1017,1084],{"__ignoreMap":414},[419,967,968,970,972,974,976,978,980,982,984],{"class":421,"line":422},[419,969,479],{"class":478},[419,971,483],{"class":482},[419,973,956],{"class":486},[419,975,501],{"class":482},[419,977,504],{"class":478},[419,979,507],{"class":482},[419,981,875],{"class":429},[419,983,513],{"class":482},[419,985,516],{"class":482},[419,987,988,990,992,994,997,1000,1002,1004,1006,1009,1011],{"class":421,"line":475},[419,989,479],{"class":478},[419,991,483],{"class":482},[419,993,956],{"class":486},[419,995,996],{"class":478}," as",[419,998,999],{"class":486}," rtSql",[419,1001,501],{"class":482},[419,1003,504],{"class":478},[419,1005,507],{"class":482},[419,1007,1008],{"class":429},"@mionjs\u002Fdrizzle-orm",[419,1010,513],{"class":482},[419,1012,516],{"class":482},[419,1014,1015],{"class":421,"line":519},[419,1016,523],{"emptyLinePlaceholder":522},[419,1018,1019,1021,1024,1026,1028,1030,1032,1035,1037,1039,1041,1044,1046,1049,1051,1053,1056,1058,1061,1063,1066,1069,1071,1074,1076,1078,1080,1082],{"class":421,"line":526},[419,1020,530],{"class":529},[419,1022,1023],{"class":486}," docs$table ",[419,1025,536],{"class":482},[419,1027,540],{"class":539},[419,1029,543],{"class":486},[419,1031,513],{"class":482},[419,1033,1034],{"class":429},"docs",[419,1036,513],{"class":482},[419,1038,490],{"class":482},[419,1040,483],{"class":482},[419,1042,1043],{"class":557},"at",[419,1045,561],{"class":482},[419,1047,1048],{"class":539}," timestamp",[419,1050,543],{"class":486},[419,1052,588],{"class":482},[419,1054,1055],{"class":557},"default",[419,1057,561],{"class":482},[419,1059,1060],{"class":486}," [",[419,1062,960],{"class":539},[419,1064,1065],{"class":482},"`",[419,1067,1068],{"class":429},"now()",[419,1070,1065],{"class":482},[419,1072,1073],{"class":486},"]",[419,1075,501],{"class":482},[419,1077,602],{"class":486},[419,1079,501],{"class":482},[419,1081,602],{"class":486},[419,1083,516],{"class":482},[419,1085,1086,1088,1090,1092,1095,1097,1099,1101,1104,1106,1108],{"class":421,"line":618},[419,1087,799],{"class":478},[419,1089,802],{"class":486},[419,1091,569],{"class":482},[419,1093,1094],{"class":539},"execute",[419,1096,543],{"class":486},[419,1098,956],{"class":539},[419,1100,1065],{"class":482},[419,1102,1103],{"class":429},"select 1",[419,1105,1065],{"class":482},[419,1107,602],{"class":486},[419,1109,516],{"class":482},[449,1111,1113],{"id":1112},"code-it-leaves-alone","Code It Leaves Alone",[405,1115,1116],{},"The command reports what it cannot place and leaves it as written, so the file still runs:",[409,1118,1123],{"className":1119,"code":1121,"language":1122},[1120],"language-text","schema.ts: drizzle-migrate-query-builder-view error [newYorkers:42]: a view built from a query builder stays on drizzle:\nits columns come from drizzle's select typing. Declare the columns explicitly to migrate it.\n","text",[416,1124,1121],{"__ignoreMap":414},[1126,1127,1128,1141],"table",{},[1129,1130,1131],"thead",{},[1132,1133,1134,1138],"tr",{},[1135,1136,1137],"th",{},"Name",[1135,1139,1140],{},"Stays with Drizzle",[1142,1143,1144,1155],"tbody",{},[1132,1145,1146,1152],{},[1147,1148,1149],"td",{},[416,1150,1151],{},"drizzle-migrate-query-builder-view",[1147,1153,1154],{},"A view built from a query builder",[1132,1156,1157,1162],{},[1147,1158,1159],{},[416,1160,1161],{},"drizzle-migrate-unfoldable-column",[1147,1163,1164,1165,1168],{},"A table with a column chain that has no one-object spelling: the same modifier twice (",[416,1166,1167],{},".array().array()","), or a reference to a table that stays with Drizzle",[449,1170,1172],{"id":1171},"converting-to-pure-types","Converting to Pure Types",[405,1174,1175,1178],{},[416,1176,1177],{},"mion convert --to type"," works on the migrated file too. It rewrites each table as a pure type plus a one-line bridge:",[409,1180,1182],{"className":411,"code":1181,"language":413,"meta":414,"style":414},"npx mion convert --to type src\u002Fdb\u002Fschema.ts\n",[416,1183,1184],{"__ignoreMap":414},[419,1185,1186,1188,1190,1193,1196,1199],{"class":421,"line":422},[419,1187,426],{"class":425},[419,1189,430],{"class":429},[419,1191,1192],{"class":429}," convert",[419,1194,1195],{"class":429}," --to",[419,1197,1198],{"class":429}," type",[419,1200,436],{"class":429},[409,1202,1204],{"className":462,"code":1203,"language":464,"meta":414,"style":414},"\u002F\u002F after drizzle-migrate\nconst users$table = pgTable('users', {id: uuid('id', {primaryKey: true}), name: varchar('user_name', {length: 50})});\nconst users = toDrizzle(users$table);\n\n\u002F\u002F after convert --to type\ntype Users$table = PgTable\u003C'users', {\n  id: Uuid\u003C{primaryKey: true}>;\n  name: Varchar\u003C{length: 50}>;\n}, [], {name: 'user_name'}>;\nconst users$table = tableFromType\u003CUsers$table>();\nconst users = toDrizzle(users$table);\n",[416,1205,1206,1211,1298,1312,1316,1321,1349,1371,1391,1416,1439],{"__ignoreMap":414},[419,1207,1208],{"class":421,"line":422},[419,1209,1210],{"class":471},"\u002F\u002F after drizzle-migrate\n",[419,1212,1213,1215,1217,1219,1221,1223,1225,1227,1229,1231,1233,1235,1237,1239,1241,1243,1245,1247,1249,1251,1253,1255,1257,1259,1261,1263,1265,1267,1269,1271,1273,1276,1278,1280,1282,1284,1286,1288,1290,1292,1294,1296],{"class":421,"line":475},[419,1214,530],{"class":529},[419,1216,692],{"class":486},[419,1218,536],{"class":482},[419,1220,540],{"class":539},[419,1222,543],{"class":486},[419,1224,513],{"class":482},[419,1226,548],{"class":429},[419,1228,513],{"class":482},[419,1230,490],{"class":482},[419,1232,483],{"class":482},[419,1234,558],{"class":557},[419,1236,561],{"class":482},[419,1238,493],{"class":539},[419,1240,543],{"class":486},[419,1242,513],{"class":482},[419,1244,558],{"class":429},[419,1246,513],{"class":482},[419,1248,490],{"class":482},[419,1250,483],{"class":482},[419,1252,572],{"class":557},[419,1254,561],{"class":482},[419,1256,726],{"class":725},[419,1258,501],{"class":482},[419,1260,602],{"class":486},[419,1262,490],{"class":482},[419,1264,579],{"class":557},[419,1266,561],{"class":482},[419,1268,498],{"class":539},[419,1270,543],{"class":486},[419,1272,513],{"class":482},[419,1274,1275],{"class":429},"user_name",[419,1277,513],{"class":482},[419,1279,490],{"class":482},[419,1281,483],{"class":482},[419,1283,591],{"class":557},[419,1285,561],{"class":482},[419,1287,597],{"class":596},[419,1289,501],{"class":482},[419,1291,602],{"class":486},[419,1293,501],{"class":482},[419,1295,602],{"class":486},[419,1297,516],{"class":482},[419,1299,1300,1302,1304,1306,1308,1310],{"class":421,"line":519},[419,1301,530],{"class":529},[419,1303,533],{"class":486},[419,1305,536],{"class":482},[419,1307,779],{"class":539},[419,1309,782],{"class":486},[419,1311,516],{"class":482},[419,1313,1314],{"class":421,"line":526},[419,1315,523],{"emptyLinePlaceholder":522},[419,1317,1318],{"class":421,"line":618},[419,1319,1320],{"class":471},"\u002F\u002F after convert --to type\n",[419,1322,1323,1326,1329,1332,1335,1338,1340,1342,1344,1346],{"class":421,"line":623},[419,1324,1325],{"class":529},"type",[419,1327,1328],{"class":425}," Users$table",[419,1330,1331],{"class":482}," =",[419,1333,1334],{"class":425}," PgTable",[419,1336,1337],{"class":482},"\u003C",[419,1339,513],{"class":482},[419,1341,548],{"class":429},[419,1343,513],{"class":482},[419,1345,490],{"class":482},[419,1347,1348],{"class":482}," {\n",[419,1350,1351,1354,1356,1359,1362,1364,1366,1368],{"class":421,"line":629},[419,1352,1353],{"class":557},"  id",[419,1355,561],{"class":482},[419,1357,1358],{"class":425}," Uuid",[419,1360,1361],{"class":482},"\u003C{",[419,1363,572],{"class":557},[419,1365,561],{"class":482},[419,1367,726],{"class":425},[419,1369,1370],{"class":482},"}>;\n",[419,1372,1373,1376,1378,1381,1383,1385,1387,1389],{"class":421,"line":659},[419,1374,1375],{"class":557},"  name",[419,1377,561],{"class":482},[419,1379,1380],{"class":425}," Varchar",[419,1382,1361],{"class":482},[419,1384,591],{"class":557},[419,1386,561],{"class":482},[419,1388,597],{"class":596},[419,1390,1370],{"class":482},[419,1392,1393,1396,1399,1401,1403,1406,1408,1410,1412,1414],{"class":421,"line":682},[419,1394,1395],{"class":482},"},",[419,1397,1398],{"class":486}," []",[419,1400,490],{"class":482},[419,1402,483],{"class":482},[419,1404,1405],{"class":557},"name",[419,1407,561],{"class":482},[419,1409,507],{"class":482},[419,1411,1275],{"class":429},[419,1413,513],{"class":482},[419,1415,1370],{"class":482},[419,1417,1418,1420,1422,1424,1427,1429,1432,1435,1437],{"class":421,"line":687},[419,1419,530],{"class":529},[419,1421,692],{"class":486},[419,1423,536],{"class":482},[419,1425,1426],{"class":539}," tableFromType",[419,1428,1337],{"class":482},[419,1430,1431],{"class":425},"Users$table",[419,1433,1434],{"class":482},">",[419,1436,566],{"class":486},[419,1438,516],{"class":482},[419,1440,1441,1443,1445,1447,1449,1451],{"class":421,"line":770},[419,1442,530],{"class":529},[419,1444,533],{"class":486},[419,1446,536],{"class":482},[419,1448,779],{"class":539},[419,1450,782],{"class":486},[419,1452,516],{"class":482},[405,1454,1455,1456,1459],{},"It works with the imports you already have (no namespace import required) and on tables declared inside a function or a test, not only at the top of a file. ",[416,1457,1458],{},"--to builders"," goes back the other way, and a file in type form converted both ways ends up exactly as it started.",[405,1461,1462,1463,1466,1467,1470],{},"Some tables have no type spelling, and the command says which and why rather than guessing: a table built by a table creator, a table declared on a schema, ",[416,1464,1465],{},"$type"," on a column, or a column name that is not a literal. Those tables stay as written and keep working, and the other tables in the file still convert. ",[416,1468,1469],{},"--report report.json"," writes the whole list to one file.",[449,1472,1474],{"id":1473},"references-to-later-tables","References to Later Tables",[405,1476,1477,1478,561],{},"A column that points at another table keeps working wherever that table is declared. When the target sits further down the file, the bridge takes a function instead of the value, like Drizzle's own ",[416,1479,1480],{},".references(() => cities.id)",[409,1482,1484],{"className":462,"code":1483,"language":464,"meta":414,"style":414},"const children$table = tableFromType\u003CChildrenTable>({tables: {cities: () => cities$table}});\n",[416,1485,1486],{"__ignoreMap":414},[419,1487,1488,1490,1493,1495,1497,1499,1502,1504,1506,1508,1511,1513,1515,1518,1520,1523,1526,1529,1532,1534],{"class":421,"line":422},[419,1489,530],{"class":529},[419,1491,1492],{"class":486}," children$table ",[419,1494,536],{"class":482},[419,1496,1426],{"class":539},[419,1498,1337],{"class":482},[419,1500,1501],{"class":425},"ChildrenTable",[419,1503,1434],{"class":482},[419,1505,543],{"class":486},[419,1507,588],{"class":482},[419,1509,1510],{"class":557},"tables",[419,1512,561],{"class":482},[419,1514,483],{"class":482},[419,1516,1517],{"class":539},"cities",[419,1519,561],{"class":482},[419,1521,1522],{"class":482}," ()",[419,1524,1525],{"class":529}," =>",[419,1527,1528],{"class":486}," cities$table",[419,1530,1531],{"class":482},"}}",[419,1533,602],{"class":486},[419,1535,516],{"class":482},[449,1537,1539],{"id":1538},"checking-the-result","Checking the Result",[405,1541,1542],{},"Read the diff, then run your type checker and your tests. Your original names still hold the real Drizzle tables, so there is very little left to check.",[1544,1545,1546],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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);}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 .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 .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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":414,"searchDepth":475,"depth":475,"links":1548},[1549,1550,1551,1552,1553,1554,1555],{"id":451,"depth":475,"text":452},{"id":868,"depth":475,"text":869},{"id":950,"depth":475,"text":951},{"id":1112,"depth":475,"text":1113},{"id":1171,"depth":475,"text":1172},{"id":1473,"depth":475,"text":1474},{"id":1538,"depth":475,"text":1539},"Move a schema file you already wrote with Drizzle ORM onto the slim packages, in one command.","md",null,{},{"title":325,"description":1556},"FX-Nhuk43PK1iWgv0Gdpq4llaobM3vJclvKU0R83Z_E",1793324366504]