{"_id":"@codehaus-au/zod-to-drizzle","_rev":"7-30c8f0344054d777d5847c78cf25d55d","name":"@codehaus-au/zod-to-drizzle","dist-tags":{"latest":"1.9.0"},"versions":{"1.3.0":{"name":"@codehaus-au/zod-to-drizzle","version":"1.3.0","keywords":["drizzle","zod","schema","orm","typescript","sqlite","postgres","mysql"],"author":{"url":"https://github.com/bil0ak","name":"Codehaus - forked from bil0ak","email":"contact@bilalakkil.com"},"license":"MIT","_id":"@codehaus-au/zod-to-drizzle@1.3.0","maintainers":[{"name":"codehausau","email":"mathew.pink@codehaus.au"}],"homepage":"https://github.com/codehausau/zod-to-drizzle","bugs":{"url":"https://github.com/codehausau/zod-to-drizzle/issues"},"dist":{"shasum":"64f11c50e47a937b4ac8a7838be7e507d66c12fc","tarball":"https://registry.npmjs.org/@codehaus-au/zod-to-drizzle/-/zod-to-drizzle-1.3.0.tgz","fileCount":7,"integrity":"sha512-RuDdw7ZHlULMBeLWe+mjCM6hFv3Q43Z6VUJKcY0I4olS1iX3/d3FjajnLOYU5aApwy5ehcFcUUD1KuOi95iSWA==","signatures":[{"sig":"MEYCIQDpUidAnB2+A2ljs9VRUC8L99BqipqU7MG8MMLwjWpm6wIhANcF96zeMhcXmAG5IWLE7HLOwFFLulyEfri2nQVCWAnu","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43244},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":"22.11.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"ff36ffa28481d606f5baa9fd089f0ab4678c4369","scripts":{"test":"bun test","build":"tsup","format":"prettier --write .","typecheck":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"codehausau","email":"mathew.pink@codehaus.au"},"repository":{"url":"git+https://github.com/codehausau/zod-to-drizzle.git","type":"git"},"_npmVersion":"10.9.3","description":"Create Drizzle ORM tables from Zod schemas","directories":{},"_nodeVersion":"22.11.0","dependencies":{"zod":"4.0.5","drizzle-orm":"0.44.3","semantic-release":"24.2.7"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","prettier":"3.6.2","@types/bun":"latest","typescript":"5.8.3","@types/node":"24.0.15"},"_npmOperationalInternal":{"tmp":"tmp/zod-to-drizzle_1.3.0_1756266478628_0.4314144744655215","host":"s3://npm-registry-packages-npm-production"}},"1.4.0":{"name":"@codehaus-au/zod-to-drizzle","version":"1.4.0","keywords":["drizzle","zod","schema","orm","typescript","sqlite","postgres","mysql"],"author":{"url":"https://github.com/bil0ak","name":"Codehaus - forked from bil0ak","email":"contact@bilalakkil.com"},"license":"MIT","_id":"@codehaus-au/zod-to-drizzle@1.4.0","maintainers":[{"name":"codehausau","email":"mathew.pink@codehaus.au"}],"homepage":"https://github.com/codehausau/zod-to-drizzle","bugs":{"url":"https://github.com/codehausau/zod-to-drizzle/issues"},"dist":{"shasum":"e6b74f4be2ec35c293d62a425c829b446a2faa86","tarball":"https://registry.npmjs.org/@codehaus-au/zod-to-drizzle/-/zod-to-drizzle-1.4.0.tgz","fileCount":7,"integrity":"sha512-swVnNs3MitGjD6Y7q7OHetVaCpk0OIJ7OOukphmKOlv9+OXo0AX/le8RPbaa58+E/78GINLt0UBAqs02z+F5WQ==","signatures":[{"sig":"MEUCICLUyQ/rwt9EeOCF358C/HC8JqxbFoGPriWZc5aIfgIGAiEAqzxLdrM2fNUDktvEWda5LBxEC0IXZeLwYwhjtb7UIUc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43300},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":"22.11.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"91498654f9cf904de6d67dbd9b8e06a0c02feebd","scripts":{"test":"bun test","build":"tsup","format":"prettier --write .","typecheck":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"codehausau","email":"mathew.pink@codehaus.au"},"repository":{"url":"git+https://github.com/codehausau/zod-to-drizzle.git","type":"git"},"_npmVersion":"10.9.3","description":"Create Drizzle ORM tables from Zod schemas","directories":{},"_nodeVersion":"22.11.0","dependencies":{"zod":"4.0.5","drizzle-orm":"0.44.3","semantic-release":"24.2.7"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","prettier":"3.6.2","@types/bun":"latest","typescript":"5.8.3","@types/node":"24.0.15"},"_npmOperationalInternal":{"tmp":"tmp/zod-to-drizzle_1.4.0_1756339480035_0.28487376304243606","host":"s3://npm-registry-packages-npm-production"}},"1.5.0":{"name":"@codehaus-au/zod-to-drizzle","version":"1.5.0","keywords":["drizzle","zod","schema","orm","typescript","sqlite","postgres","mysql"],"author":{"url":"https://github.com/bil0ak","name":"Codehaus - forked from bil0ak","email":"contact@bilalakkil.com"},"license":"MIT","_id":"@codehaus-au/zod-to-drizzle@1.5.0","maintainers":[{"name":"codehausau","email":"mathew.pink@codehaus.au"}],"homepage":"https://github.com/codehausau/zod-to-drizzle","bugs":{"url":"https://github.com/codehausau/zod-to-drizzle/issues"},"dist":{"shasum":"57dc4cd949c145d50693005dc739c29ca2f2b31a","tarball":"https://registry.npmjs.org/@codehaus-au/zod-to-drizzle/-/zod-to-drizzle-1.5.0.tgz","fileCount":7,"integrity":"sha512-RdC7gUUX7BjGrnNiOKCKAPxYT2NzA7y4AIZ0yfU1wCsHDFoWGSTsf2X78s/So8X4xVXbeQys1oTIgvR+mOQn+A==","signatures":[{"sig":"MEQCICVVyuo27EnuspTVhwxhqw5b/jSwCCGq3Jm+JFPsXyjPAiAQLOnjkEfTOYN5z9QdYCoZGRyvPpF/WeI7N5/t0LZ0sg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45724},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":"22.11.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"a7509527c3eedcbe2fb5a197edfc816ad3b65299","scripts":{"test":"bun test","build":"tsup","format":"prettier --write .","typecheck":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"codehausau","email":"mathew.pink@codehaus.au"},"repository":{"url":"git+https://github.com/codehausau/zod-to-drizzle.git","type":"git"},"_npmVersion":"10.9.3","description":"Create Drizzle ORM tables from Zod schemas","directories":{},"_nodeVersion":"22.11.0","dependencies":{"zod":"4.0.5","drizzle-orm":"0.44.3","semantic-release":"24.2.7"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","prettier":"3.6.2","@types/bun":"latest","typescript":"5.8.3","@types/node":"24.0.15"},"_npmOperationalInternal":{"tmp":"tmp/zod-to-drizzle_1.5.0_1758170486086_0.24881404982974575","host":"s3://npm-registry-packages-npm-production"}},"1.6.0":{"name":"@codehaus-au/zod-to-drizzle","version":"1.6.0","keywords":["drizzle","zod","schema","orm","typescript","sqlite","postgres","mysql"],"author":{"url":"https://github.com/bil0ak","name":"Codehaus - forked from bil0ak","email":"contact@bilalakkil.com"},"license":"MIT","_id":"@codehaus-au/zod-to-drizzle@1.6.0","maintainers":[{"name":"codehausau","email":"mathew.pink@codehaus.au"}],"homepage":"https://github.com/codehausau/zod-to-drizzle","bugs":{"url":"https://github.com/codehausau/zod-to-drizzle/issues"},"dist":{"shasum":"5afc6d1e4bb2b15d00d959c47f642d1a4fe8b4fe","tarball":"https://registry.npmjs.org/@codehaus-au/zod-to-drizzle/-/zod-to-drizzle-1.6.0.tgz","fileCount":7,"integrity":"sha512-Fr4GSSaeqicB1fMyIEwcoZsTeZsBe5WC8Ze5YwBh8plz2iFU8bkQ/KJCUSCustVUwZlCtoa1/vH3euyjYeINJw==","signatures":[{"sig":"MEQCIG4rP0xwL9D23iGsLp15wD717VEyCnGF/OOvsG6yMvRHAiBvAIACACMPHqe5bWP7645V5k7im0Sai1+WZVzUVvTYSg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":45582},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":"22.11.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"c3f37d70039aadb9969f709ff45b1224af4e7918","scripts":{"test":"bun test","build":"tsup","format":"prettier --write .","typecheck":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"codehausau","email":"mathew.pink@codehaus.au"},"repository":{"url":"git+https://github.com/codehausau/zod-to-drizzle.git","type":"git"},"_npmVersion":"10.9.3","description":"Create Drizzle ORM tables from Zod schemas","directories":{},"_nodeVersion":"22.11.0","dependencies":{"zod":"4.0.5","drizzle-orm":"0.44.3","semantic-release":"24.2.7"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","prettier":"3.6.2","@types/bun":"latest","typescript":"5.8.3","@types/node":"24.0.15"},"_npmOperationalInternal":{"tmp":"tmp/zod-to-drizzle_1.6.0_1758505499172_0.43811933851665263","host":"s3://npm-registry-packages-npm-production"}},"1.7.0":{"name":"@codehaus-au/zod-to-drizzle","version":"1.7.0","keywords":["drizzle","zod","schema","orm","typescript","sqlite","postgres","mysql"],"author":{"url":"https://github.com/bil0ak","name":"Codehaus - forked from bil0ak","email":"contact@bilalakkil.com"},"license":"MIT","_id":"@codehaus-au/zod-to-drizzle@1.7.0","maintainers":[{"name":"codehausau","email":"mathew.pink@codehaus.au"}],"homepage":"https://github.com/codehausau/zod-to-drizzle","bugs":{"url":"https://github.com/codehausau/zod-to-drizzle/issues"},"dist":{"shasum":"3217a7924b83a027b6dd14a8491ad665846ea346","tarball":"https://registry.npmjs.org/@codehaus-au/zod-to-drizzle/-/zod-to-drizzle-1.7.0.tgz","fileCount":7,"integrity":"sha512-k/54g2XiLr9DdkQVgboKy12OUZEbqxQwtdH/UYCG2TQR+4cgDc+4PMCbz9ds+kzC34Sin7tnSbNbxST2+7shYg==","signatures":[{"sig":"MEQCICUNjnfDcQcO+JDvQh1IYZo/RRvhO4Jl/vHDG8fy+D8pAiBKwAlSkxo0RL5NSfTe0CvdANWDYDI1jBvwvEPqsBGkKw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53645},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":"22.11.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"2375c81937e93e4ecf6014ff702883b9ffc4f951","scripts":{"test":"bun test","build":"tsup","format":"prettier --write .","typecheck":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"codehausau","email":"mathew.pink@codehaus.au"},"repository":{"url":"git+https://github.com/codehausau/zod-to-drizzle.git","type":"git"},"_npmVersion":"10.9.7","description":"Create Drizzle ORM tables from Zod schemas","directories":{},"_nodeVersion":"22.11.0","dependencies":{"zod":"4.0.5","drizzle-orm":"0.44.3","semantic-release":"24.2.7"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","prettier":"3.6.2","@types/bun":"latest","typescript":"5.8.3","@types/node":"24.0.15"},"_npmOperationalInternal":{"tmp":"tmp/zod-to-drizzle_1.7.0_1774585760156_0.48929698467859883","host":"s3://npm-registry-packages-npm-production"}},"1.8.0":{"name":"@codehaus-au/zod-to-drizzle","version":"1.8.0","keywords":["drizzle","zod","schema","orm","typescript","sqlite","postgres","mysql"],"author":{"url":"https://github.com/bil0ak","name":"Codehaus - forked from bil0ak","email":"contact@bilalakkil.com"},"license":"MIT","_id":"@codehaus-au/zod-to-drizzle@1.8.0","maintainers":[{"name":"codehausau","email":"mathew.pink@codehaus.au"}],"homepage":"https://github.com/codehausau/zod-to-drizzle","bugs":{"url":"https://github.com/codehausau/zod-to-drizzle/issues"},"dist":{"shasum":"d74b23004fb7c1659cd895b38613ad0d0fa80a6a","tarball":"https://registry.npmjs.org/@codehaus-au/zod-to-drizzle/-/zod-to-drizzle-1.8.0.tgz","fileCount":7,"integrity":"sha512-WAOXHaoTT+A7lQLTqjo/f5XLRg6gYhz+zaQd+iSD7W81FTf02GC47L2Q7lCMj8Ln431KBTPi4Maw6N7Hvyv2gQ==","signatures":[{"sig":"MEUCIFWCQza/6RZcpMtl8/0YmNTcFYr/5ntfb+LQew4moIInAiEA2+V3XrMLct8R8mX/jfKo+q4Yz96sr4A7IkM7oFOzP3Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57313},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":"22.11.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"bf4d721974d2a4097f4497be1d836c31f2611b75","scripts":{"test":"bun test","build":"tsup","format":"prettier --write .","typecheck":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"codehausau","email":"mathew.pink@codehaus.au"},"repository":{"url":"git+https://github.com/codehausau/zod-to-drizzle.git","type":"git"},"_npmVersion":"10.9.8","description":"Create Drizzle ORM tables from Zod schemas","directories":{},"_nodeVersion":"22.11.0","dependencies":{"zod":"4.0.5","drizzle-orm":"0.44.3","semantic-release":"24.2.7"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.0","prettier":"3.6.2","@types/bun":"latest","typescript":"5.8.3","@types/node":"24.0.15"},"_npmOperationalInternal":{"tmp":"tmp/zod-to-drizzle_1.8.0_1774673639107_0.5642680744176121","host":"s3://npm-registry-packages-npm-production"}},"1.9.0":{"name":"@codehaus-au/zod-to-drizzle","version":"1.9.0","description":"Create Drizzle ORM tables from Zod schemas","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"scripts":{"test":"bun test","typecheck":"tsc --noEmit","format":"prettier --write .","build":"tsup","prepublishOnly":"bun run build"},"keywords":["drizzle","zod","schema","orm","typescript","sqlite","postgres","mysql"],"author":{"name":"Codehaus - forked from bil0ak","email":"contact@bilalakkil.com","url":"https://github.com/bil0ak"},"repository":{"type":"git","url":"git+https://github.com/codehausau/zod-to-drizzle.git"},"homepage":"https://github.com/codehausau/zod-to-drizzle","license":"MIT","dependencies":{"drizzle-orm":"0.44.3","semantic-release":"24.2.7","zod":"4.0.5"},"devDependencies":{"@types/bun":"latest","@types/node":"24.0.15","prettier":"3.6.2","tsup":"8.5.0","typescript":"5.8.3"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"engines":{"node":"22.11.0"},"_id":"@codehaus-au/zod-to-drizzle@1.9.0","gitHead":"9a3d387208157e4df4d058e3bd57171e57a2886c","bugs":{"url":"https://github.com/codehausau/zod-to-drizzle/issues"},"_nodeVersion":"22.11.0","_npmVersion":"10.9.8","dist":{"integrity":"sha512-7OeA3sqSg8olS4rcXI5FcXoCqEg3uEonWfyFFQGhXjuADGDvoIp8aHvt+1Az8ubVb+irip4K3B6A8M1A99oFzw==","shasum":"92d8c6fc9eda3fa9a633a5198dd4e0cd4c947ce9","tarball":"https://registry.npmjs.org/@codehaus-au/zod-to-drizzle/-/zod-to-drizzle-1.9.0.tgz","fileCount":7,"unpackedSize":59491,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCID2O/c4YfrRKvrK0RDntWMpeMzW3zOczeIbJvjTFh08DAiEAmQ9jowfzTyhwv9SKp+s18vAb4u68TIL+LYvXGwoiqZE="}]},"_npmUser":{"name":"codehausau","email":"mathew.pink@codehaus.au"},"directories":{},"maintainers":[{"name":"codehausau","email":"mathew.pink@codehaus.au"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/zod-to-drizzle_1.9.0_1784773267595_0.9521519933609743"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-27T03:47:58.562Z","modified":"2026-07-23T02:21:07.889Z","1.3.0":"2025-08-27T03:47:58.860Z","1.4.0":"2025-08-28T00:04:40.236Z","1.5.0":"2025-09-18T04:41:26.284Z","1.6.0":"2025-09-22T01:44:59.373Z","1.7.0":"2026-03-27T04:29:20.297Z","1.8.0":"2026-03-28T04:53:59.247Z","1.9.0":"2026-07-23T02:21:07.723Z"},"bugs":{"url":"https://github.com/codehausau/zod-to-drizzle/issues"},"author":{"name":"Codehaus - forked from bil0ak","email":"contact@bilalakkil.com","url":"https://github.com/bil0ak"},"license":"MIT","homepage":"https://github.com/codehausau/zod-to-drizzle","keywords":["drizzle","zod","schema","orm","typescript","sqlite","postgres","mysql"],"repository":{"type":"git","url":"git+https://github.com/codehausau/zod-to-drizzle.git"},"description":"Create Drizzle ORM tables from Zod schemas","maintainers":[{"name":"codehausau","email":"mathew.pink@codehaus.au"}],"readme":"# zod-to-drizzle\n\nConvert [Zod](https://zod.dev) schemas to [Drizzle ORM](https://orm.drizzle.team) tables with TypeScript support.\n\n## Features\n\n- 🚀 Convert Zod schemas to Drizzle tables\n- 🔑 Automatic primary key handling\n- 🔗 Type-safe foreign key references\n- 📝 Full TypeScript support\n- 🎯 Support for SQLite (PostgreSQL & MySQL coming soon)\n- 🎨 Support for all common Zod types\n\n## Installation\n\n```bash\nbun add zod-to-drizzle\n# or\nnpm install zod-to-drizzle\n# or\npnpm add zod-to-drizzle\n# or\nyarn add zod-to-drizzle\n```\n\n## Quick Start\n\n```typescript\nimport { createTableFromZod } from \"zod-to-drizzle\";\nimport { z } from \"zod\";\nimport { SQLiteTable } from \"drizzle-orm/sqlite-core\";\n\n// Define your schema\nconst UserSchema = z.object({\n  id: z.number(),\n  name: z.string(),\n  email: z.string().email().optional(),\n  createdAt: z.number().default(Date.now),\n});\n\n// Create a table\nconst users = createTableFromZod(\"users\", UserSchema, {\n  dialect: \"sqlite\",\n  primaryKey: \"id\",\n}) as SQLiteTable;\n```\n\n## Foreign Keys\n\n```typescript\n// Define schemas\nconst UserSchema = z.object({\n  id: z.number(),\n  name: z.string(),\n});\n\nconst PostSchema = z.object({\n  id: z.number(),\n  title: z.string(),\n  userId: z.number(),\n});\n\n// Create tables with references\nconst users = createTableFromZod(\"users\", UserSchema, {\n  dialect: \"sqlite\",\n  primaryKey: \"id\",\n});\n\nconst posts = createTableFromZod(\"posts\", PostSchema, {\n  dialect: \"sqlite\",\n  primaryKey: \"id\",\n  references: [\n    {\n      table: users,\n      columns: [[\"userId\", \"id\"]],\n    },\n  ],\n});\n```\n\n## Column Constraints\n\n```typescript\nimport { sql } from \"drizzle-orm\";\n\nconst UserSchema = z.object({\n  id: z.number(),\n  email: z.string().optional(),\n  age: z.number(),\n});\n\nconst users = createTableFromZod(\"users\", UserSchema, {\n  dialect: \"postgres\",\n  primaryKey: \"id\",\n  constraints: {\n    email: {\n      notNull: true,\n      unique: {\n        name: \"users_email_unique\",\n        nulls: \"not distinct\",\n      },\n    },\n    age: {\n      default: 18,\n      checks: {\n        name: \"users_age_non_negative\",\n        expression: (column) => sql`${column} >= 0`,\n      },\n    },\n  },\n});\n```\n\nSupported constraint options:\n\n- `notNull`\n- `default`\n- `unique`\n- `checks`\n\n## Supported Types\n\n| Zod Type            | SQLite | PostgreSQL | MySQL |\n| ------------------- | ------ | ---------- | ----- |\n| `z.string()`        | ✅     | 🔜         | 🔜    |\n| `z.number()`        | ✅     | 🔜         | 🔜    |\n| `z.boolean()`       | ✅     | 🔜         | 🔜    |\n| `z.date()`          | ✅     | 🔜         | 🔜    |\n| `z.enum()`          | ✅     | 🔜         | 🔜    |\n| `z.object()` (JSON) | ✅     | 🔜         | 🔜    |\n| `z.array()` (JSON)  | ✅     | 🔜         | 🔜    |\n| `z.optional()`      | ✅     | 🔜         | 🔜    |\n| `z.nullable()`      | ✅     | 🔜         | 🔜    |\n| `z.default()`       | ✅     | 🔜         | 🔜    |\n\n## API Reference\n\n### createTableFromZod\n\n```typescript\nfunction createTableFromZod<T extends z.ZodObject<any>>(\n  tableName: string,\n  schema: T,\n  options: {\n    dialect?: \"sqlite\" | \"postgres\" | \"mysql\";\n    primaryKey?: keyof z.infer<T>;\n    primaryKeyIdentity?: {\n      type?: \"always\" | \"byDefault\";\n      name?: string;\n      startWith?: number | string;\n      increment?: number | string;\n      minValue?: number | string;\n      maxValue?: number | string;\n      cache?: number | string;\n      cycle?: boolean;\n    };\n    constraints?: Partial<{\n      [K in keyof z.infer<T>]: {\n        notNull?: boolean;\n        default?: z.infer<T>[K];\n        unique?:\n          | boolean\n          | string\n          | {\n              name?: string;\n              nulls?: \"distinct\" | \"not distinct\";\n            };\n        checks?:\n          | {\n              name: string;\n              expression: (column, columns) => SQL;\n            }\n          | Array<{\n              name: string;\n              expression: (column, columns) => SQL;\n            }>;\n      };\n    }>;\n    references?: Array<{\n      table: SQLiteTable;\n      columns: [keyof z.infer<T>, string][];\n    }>;\n  },\n);\n```\n\n#### Parameters\n\n- `tableName`: The name of the table\n- `schema`: Zod object schema\n- `options`:\n  - `dialect`: Database dialect (default: \"sqlite\")\n  - `primaryKey`: Column to use as primary key\n  - `primaryKeyIdentity`: PostgreSQL identity options for numeric primary keys\n  - `constraints`: Column-level database constraints\n  - `references`: Array of foreign key references\n\n### PostgreSQL Identity Start Value\n\n```typescript\nconst users = createTableFromZod(\"users\", UserSchema, {\n  dialect: \"postgres\",\n  primaryKey: \"id\",\n  primaryKeyIdentity: {\n    startWith: 1000,\n  },\n});\n```\n\nBy default numeric PostgreSQL primary keys use `generatedAlwaysAsIdentity()`.\nSet `type: \"byDefault\"` to allow explicit IDs with `generatedByDefaultAsIdentity()`.\n\n## Examples\n\n### Common Schema Pattern\n\n```typescript\nconst CommonSchema = z.object({\n  id: z.number(),\n  createdAt: z.number().default(Date.now()),\n  updatedAt: z.number().nullish(),\n  deletedAt: z.number().nullish(),\n  createdBy: z.number(),\n  updatedBy: z.number().nullish(),\n  deletedBy: z.number().nullish(),\n  deleted: z.boolean().default(false),\n});\n\nconst UserSchema = CommonSchema.extend({\n  name: z.string(),\n  email: z.string().email(),\n  role: z.enum([\"admin\", \"user\"]),\n});\n\nconst users = createTableFromZod(\"users\", UserSchema, {\n  dialect: \"sqlite\",\n  primaryKey: \"id\",\n});\n```\n\n### Complex Types\n\n```typescript\nconst Schema = z.object({\n  id: z.number(),\n  metadata: z.object({ key: z.string() }), // Stored as JSON (TEXT in SQLite)\n  tags: z.array(z.string()), // Stored as JSON (TEXT in SQLite)\n  settings: z.record(z.string()), // Stored as JSON (TEXT in SQLite)\n  role: z.enum([\"admin\", \"user\"]), // Stored as text\n});\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.\n\n## License\n\nApache-2.0 - see [LICENSE](LICENSE) for details.\n","readmeFilename":"README.md"}