using postgres functions from knex
See original GitHub issueso I’m using timestamptz with specificType I need to be able to use postgres’s native date-time functions to set a default.
I tried
table.specificType('currentTime', 'timestamptz').defaultTo('now()');
but that ends up setting the default value to the most current time stamp as a static value. How do i pass along postgresql functions.
basically I want to do this, But in knex.
ALTER TABLE "public"."users" ADD COLUMN "currentTime" TIMESTAMP WITH TIME ZONE DEFAULT now();
Issue Analytics
- State:
- Created 10 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Calling functions on PostgreSQL #2044 - knex/knex - GitHub
Hi, Is there a way calling postgres functions without using knex.raw() in order to get the result parsed to an object using the...
Read more >Knex Query Builder
The heart of the library, the knex query builder is the interface used for building and executing standard SQL queries, such as select...
Read more >Knex.js and Postgres - Magistrate
Knex.js is a SQL query builder based on Laravel Query Builder. It supports a handful of different databases, most importantly Postgres.
Read more >How to call custom function from postgresql use objection js ...
I found the answer. I use objection js to call knex raw. let _data = await Model.knex().raw('select * from function_name(?, ?)
Read more >Setting up a Node API with Postgres and Knex
In this article, I would be setting up a Node project with Postgres database and Knex query builder. What is Knex. Knex.js is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Btw, for anyone having this same issue, the fix (workaround?) is to wrap that value in a
knex.raw
, so:@tgriesser is on a roll today!