{"id":15355007,"url":"https://github.com/capaj/knex-pg-schema-code-gen","last_synced_at":"2025-06-14T21:39:22.333Z","repository":{"id":66342114,"uuid":"134047985","full_name":"capaj/knex-pg-schema-code-gen","owner":"capaj","description":"generates a knex schema createTable calls from an existing database","archived":false,"fork":false,"pushed_at":"2018-05-19T14:00:23.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T22:05:17.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/capaj.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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":"2018-05-19T09:25:17.000Z","updated_at":"2018-05-19T14:00:24.000Z","dependencies_parsed_at":"2023-02-24T23:00:16.230Z","dependency_job_id":null,"html_url":"https://github.com/capaj/knex-pg-schema-code-gen","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"d98aac516bd7ee261aa394993f667f4429c95228"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/capaj/knex-pg-schema-code-gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fknex-pg-schema-code-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fknex-pg-schema-code-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fknex-pg-schema-code-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fknex-pg-schema-code-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capaj","download_url":"https://codeload.github.com/capaj/knex-pg-schema-code-gen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capaj%2Fknex-pg-schema-code-gen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259888189,"owners_count":22927073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-01T12:22:05.730Z","updated_at":"2025-06-14T21:39:22.307Z","avatar_url":"https://github.com/capaj.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# knex-pg-schema-code-gen\n\ngenerates a knex schema createTable calls from your exisitng Postgre database. Useful when you want to start using knex for instrumenting your DB in tests for example.\nSure you could just make a dump of your schema, but if you want to keep changing the DB schema you'd have to either manually change the SQL dump or you'd have to make a new dump every time.\nHaving the DB instrumentation in JS makes it much more maintainable in the long run.\n\n## Usage\n\n```javascript\nimport schemaGenerator from './schema-gen'\nimport knex from 'knex'\n\nconst db = knex({\n  client: 'pg',\n  connection: {\n    // your DB connection details here\n  }\n})\nconst schemaCode = await schemaGenerator(db)  // schema is a string with calls for all tables\nconst schemaCode = await schemaGenerator(db, 'my_uber_table')  // optionally you can call with second argument to limit for just one table\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fknex-pg-schema-code-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapaj%2Fknex-pg-schema-code-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapaj%2Fknex-pg-schema-code-gen/lists"}