Skip to content

Releases: kriasoft/knex-types

v0.5.0

02 Dec 12:11
Compare
Choose a tag to compare

v0.4.0

03 May 14:34
Compare
Choose a tag to compare
  • feat: Generate Tables type (#14) — @d7ark

v0.3.2

22 Nov 17:16
Compare
Choose a tag to compare
  • Escape generated property names containing spaces or special characters (#11) — @bhenderson

v0.3.1

01 Sep 11:04
9084cdd
Compare
Choose a tag to compare

v0.3.0

17 Aug 17:12
Compare
Choose a tag to compare
updateSchema(db, {
  schema: ["public", "log"], // defaults to "public"
  exclude: ["migrate", "migrate_lock"], // defaults to []
}

v0.2.0

19 Apr 12:33
Compare
Choose a tag to compare

Allow to add a custom prefix; improve the supported type coverage.

updateTypes({
  output: `./types.ts`,
  // Inject a custom import at the top of the generated file
  prefix: `import { PostgresInterval } from "postgres-interval";`
});

Drop generation of EntityRecord types, use Knex.DbRecord<Entity> instead.

v0.1.4

18 Apr 16:09
Compare
Choose a tag to compare

Add citext[] db type, saving it as string[].

v0.1.3

14 Apr 11:34
Compare
Choose a tag to compare

An utility module for Knex.js that generates TypeScript definitions (types) from a PostgreSQL database schema.

$ npm install knex
$ npm install knex-types --dev

Usage Example

const { knex } = require("knex");
const { updateTypes } = require("knex-types");

const db = knex(require("./knexfile"));

updateTypes(db, { output: "./types.ts" }).catch((err) => {
  console.error(err);
  process.exit(1);
});

Find an example of generated types in ./main.test.ts.