Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
First, thanks for the great work on this module!
Second, is this presently possible in the schema builder in some form I'm not aware of?
The text was updated successfully, but these errors were encountered:
Thanks! I think it should be if you do defaultTo(knex.raw('now()')) etc. Let me know if that doesn't work, I'm in the process of doing a huge refactor to make more consistent use of raw, sub selects, etc throughout the library.
Sadly no! It produces this: TypeError: Converting circular structure to JSON
TypeError: Converting circular structure to JSON
Ah shoot... I'll have to take a look at it sometime tomorrow.
Thanks Tim! I really appreciate the super fast response.
fix for #146, allowing knex.raw in defaultTo
Merge pull request #147 from tgriesser/defaultTo-raw
Fix for #146, allowing knex.raw in defaultTo
Alright, should be good to go and out on 0.5.4 - let me know if you see any other issues... Thanks!
@tgriesser hi ,I wanna build sql like this :
select name ,age, year(curDate())-year(birthDate)) as age from Student.
the mysql inner function curDate() must use raw,but I don't know how to connect with select , could you please help me ? thanks ~~~
@kevin-romens please open new issues in future, this has been closed for two and a half years (and is off topic).
knex.raw('(year(curDate()) - year(birthDate)) as age')
Probably just a typo - but this would define two columns with the same name age.
@rhys-vdw got it . thank you !
Successfully merging a pull request may close this issue.