Releases: kriasoft/knex-types
Releases · kriasoft/knex-types
v0.5.0
v0.4.0
v0.3.2
v0.3.1
v0.3.0
v0.2.0
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
v0.1.3
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
.