{"id":13768491,"url":"https://github.com/gajus/database-types","last_synced_at":"2025-04-15T21:34:31.676Z","repository":{"id":66001160,"uuid":"93543087","full_name":"gajus/database-types","owner":"gajus","description":"A generic type generator for various databases.","archived":false,"fork":false,"pushed_at":"2018-11-12T23:42:59.000Z","size":16,"stargazers_count":26,"open_issues_count":5,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T01:34:28.526Z","etag":null,"topics":["flow","flowtype","javascript","postgres","postgresql"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gajus.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}},"created_at":"2017-06-06T17:03:07.000Z","updated_at":"2022-04-08T03:28:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"d47a2ff7-8ccf-4438-aa6b-d1ed273cc335","html_url":"https://github.com/gajus/database-types","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"417f51e4c625667ffc70158b8f26d5072cabfcf5"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fdatabase-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fdatabase-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fdatabase-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fdatabase-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gajus","download_url":"https://codeload.github.com/gajus/database-types/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248809059,"owners_count":21164896,"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":["flow","flowtype","javascript","postgres","postgresql"],"created_at":"2024-08-03T16:01:22.086Z","updated_at":"2025-04-15T21:34:31.640Z","avatar_url":"https://github.com/gajus.png","language":"JavaScript","readme":"# database-types\n\n[![Travis build status](http://img.shields.io/travis/gajus/database-types/master.svg?style=flat-square)](https://travis-ci.org/gajus/database-types)\n[![Coveralls](https://img.shields.io/coveralls/gajus/database-types.svg?style=flat-square)](https://coveralls.io/github/gajus/database-types)\n[![NPM version](http://img.shields.io/npm/v/database-types.svg?style=flat-square)](https://www.npmjs.org/package/database-types)\n[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)\n[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social\u0026label=Follow)](https://twitter.com/kuizinas)\n\nA generic type generator for various databases.\n\nThe current supported database backend is Postgres. Track [#1 issue](https://github.com/gajus/database-types/issues/1) for MySQL support.\n\n## Use case\n\nIf you are developing applications in JavaScript and using either of the strict type systems, then you can use `database-types` to generate types describing the database.\n\n## Example usage\n\n### Generating Flow types\n\n```bash\nexport DATABASE_TYPES_DATABASE_CONNECTION_URI=postgres://postgres:password@127.0.0.1/test\nexport DATABASE_TYPES_COLUMN_FILTER=\"return !['raster_overviews', 'raster_columns', 'geometry_columns', 'geography_columns', 'spatial_ref_sys'].includes(tableName)\"\nexport DATABASE_TYPES_DIALECT=flow\n\ndatabase-types generate-types \u003e ./types.js\n\n```\n\nThis generates file containing Flow type declarations in the following format:\n\n```js\nexport type ReservationSeatRecordType = {|\n  +createdAt: string,\n  +id: number,\n  +reservationId: number,\n  +seatId: number\n|};\n\nexport type TicketTypeRecordType = {|\n  +cinemaId: number,\n  +id: number,\n  +name: string,\n  +nid: string,\n  +policy: string | null\n|};\n\n// ...\n\n```\n\n## CLI\n\n```bash\n$ npm install database-types -g\n$ database-types --help\n\n```\n","funding_links":[],"categories":["Packages / Helpers"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgajus%2Fdatabase-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgajus%2Fdatabase-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgajus%2Fdatabase-types/lists"}