{"id":15050540,"url":"https://github.com/adrienz/drizzle-schema-checker","last_synced_at":"2026-02-16T20:03:47.003Z","repository":{"id":257115481,"uuid":"857493991","full_name":"adrienZ/drizzle-schema-checker","owner":"adrienZ","description":"Checks if a Drizzle schema is also valid in a database","archived":false,"fork":false,"pushed_at":"2025-04-01T16:39:28.000Z","size":395,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T02:22:43.162Z","etag":null,"topics":["database","database-schema","db0","drizzle","drizzle-orm","sqlite","validation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrienZ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-14T19:55:39.000Z","updated_at":"2025-04-01T16:39:32.000Z","dependencies_parsed_at":"2024-09-14T23:15:19.967Z","dependency_job_id":"6f866efb-3e05-4509-a2c2-6da97900a11d","html_url":"https://github.com/adrienZ/drizzle-schema-checker","commit_stats":null,"previous_names":["adrienz/drizzle-schema-checker"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/adrienZ/drizzle-schema-checker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrienZ%2Fdrizzle-schema-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrienZ%2Fdrizzle-schema-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrienZ%2Fdrizzle-schema-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrienZ%2Fdrizzle-schema-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrienZ","download_url":"https://codeload.github.com/adrienZ/drizzle-schema-checker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrienZ%2Fdrizzle-schema-checker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29516954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T18:37:19.720Z","status":"ssl_error","status_checked_at":"2026-02-16T18:36:46.920Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-schema","db0","drizzle","drizzle-orm","sqlite","validation"],"created_at":"2024-09-24T21:27:13.326Z","updated_at":"2026-02-16T20:03:46.981Z","avatar_url":"https://github.com/adrienZ.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# drizzle-schema-checker\n\nChecks if a Drizzle schema is also valid in a database.\n\nuses [unjs/db0](https://github.com/unjs/db0) to connect your database.\n\n---\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n[![Codecov][codecov-src]][codecov-href]\n\n---\n\n## Installation\n\n```bash\nnpm install drizzle-schema-checker\n# or\npnpm add drizzle-schema-checker\n```\n\n## Usage\n\nFirst, create your schemas using Zod:\n\n```typescript\n// schema.ts\nimport { sqliteTable, text, integer, primaryKey } from \"drizzle-orm/sqlite-core\";\nimport { sql } from \"drizzle-orm\";\n\nexport const userTable = sqliteTable(\"users\", {\n  id: text(\"id\").primaryKey().notNull(),\n  password: text(\"password\"),\n  email: text(\"email\").notNull().unique(),\n  created_at: integer(\"created_at\", { mode: \"timestamp\" }).notNull().default(sql`CURRENT_TIMESTAMP`),\n  updated_at: integer(\"updated_at\", { mode: \"timestamp\" }).notNull().default(sql`CURRENT_TIMESTAMP`),\n});\n```\n\nThen, use the `checkDatabaseValidity` function to validate your database:\n\n```typescript\n// your db stuff\nimport { createChecker } from 'drizzle-schema-checker';\nimport sqlite from \"db0/connectors/better-sqlite3\";\nimport { createDatabase } from \"db0\";\nimport { userTable } from './schema';\n\nconst db = createDatabase(sqlite());\nconst dbChecker = createChecker(db, \"sqlite\");\n\ntry {\n  const validatedTable = await checker.checkTable(\"user\", userTable);\n  console.log('table user is valid in db');\n} catch (error) {\n  console.error(error.message);\n}\n```\n\n\n## Roadmap\n\n- [x] Remove any [slip](https://github.com/adrienZ/slip) code\n  - [x] tableNames\n- [x] [SQLite](https://db0.unjs.io/connectors/sqlite) support\n- [x] [Bun SQlite](https://db0.unjs.io/connectors/bun) support\n- [x] [LibSQL](https://db0.unjs.io/connectors/libsql) support\n- [ ] [PostgreSQL](https://db0.unjs.io/connectors/postgresql) support\n- [x] [Cloudflare D1](https://db0.unjs.io/connectors/cloudflare) support\n- [ ] [MySQL](https://db0.unjs.io/connectors/mysql) support\n\n## Development\n\n### Prerequisites\n\n- pnpm\n- Bun (for testing)\n\n### Setup\n\n1. Clone the repository:\n   ```\n   git clone https://github.com/adrienZ/drizzle-schema-checker.git\n   cd drizzle-schema-checker\n   ```\n\n2. Install dependencies:\n   ```\n   pnpm install\n   ```\n\n3. Build the project:\n   ```\n   pnpm build\n   ```\n\n### Testing\n\nTo run tests using Vitest:\n\n```\npnpm test\n```\n\nTo run tests with coverage:\n\n```\npnpm test:ci\n```\n\n### Linting and Formatting\n\n- Lint: `pnpm lint`\n- Format: `pnpm format`\n\n## License\n\nMIT\n\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: https://img.shields.io/npm/v/drizzle-schema-checker/latest.svg?style=flat\u0026colorA=020420\u0026colorB=00DC82\n[npm-version-href]: https://npmjs.com/package/drizzle-schema-checker\n\n[npm-downloads-src]: https://img.shields.io/npm/dm/drizzle-schema-checker.svg?style=flat\u0026colorA=020420\u0026colorB=00DC82\n[npm-downloads-href]: https://npmjs.com/package/drizzle-schema-checker\n\n[license-src]: https://img.shields.io/npm/l/drizzle-schema-checker.svg?style=flat\u0026colorA=020420\u0026colorB=00DC82\n[license-href]: https://npmjs.com/package/drizzle-schema-checker\n\n\n[codecov-src]: https://codecov.io/gh/adrienZ/drizzle-schema-checker/graph/badge.svg?token=SPS4DURB2A\n[codecov-href]: https://codecov.io/gh/adrienZ/drizzle-schema-checker\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrienz%2Fdrizzle-schema-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrienz%2Fdrizzle-schema-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrienz%2Fdrizzle-schema-checker/lists"}