Skip to content

tzezar/kysely-codegen-timestamp-to-string-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

kysely-codegen-timestamp-to-string-script

What is this?

It is workaround for not configurable kysely-codegen behaviour that generates Date type for timestamps.

How to use:

Copy script to your project, and set proper paths. Then add execution of script to package.json script running kysely-codegen type generation.

Eg. "database:push": "npm run database:generate:migration && npm run database:migrate && npm run database:generate:types && node src/utils/kysely-codegen-timestamp-to-string.js"

You may also want to parse values with pg.types like so:

const timestampzTypeId = 1184;
const dateTypeId = 1082;

pg.types.setTypeParser(timestampzTypeId, (val: string) => {
  return String(val);
});

pg.types.setTypeParser(dateTypeId, (val: string) => {
  return String(val);
});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published