New issue
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? Sign in to your account
Support for View Creation #1626
Comments
+1 This would be very useful since Knex acts as an abstraction over different SQL syntaxes between our development (SQLite) and production (Postgres) databases. |
Sorry, no such support in knex so far. @KMayne you just need to create own query abstraction with knex.raw depending if it is ran on sqlite or pg. |
@elhigu I was looking for the ability to have view creation/maintainence in migrations as well. You mention that knex.raw can be used. Can you give a quick example of how to achieve this using knex.raw? I'm assuming you don't mean create the entire view with knex.raw, but just sub in 'create view' vs 'create table' somehow with knex. We use postgres in our project. |
What kind of query you need to have generated? |
Something like these (depending on the options we're looking to use at view creation time):
|
This should work for your cases:
|
Any news on views creation in the Knex API? Would be really nice to have an generic API integration instead of database dependent creation commands. |
@gpetrov This functionality is still missing, but any contributions on that front would be dearly appreciated. |
Maybe @rijkvanzanten can help - there is also a great need for query the views schema, next to creating and managing them. All databases, even SQLite have Views support and those are pretty powerful. |
This is now available in 0.95.12-rc4 |
Hi,
Is there any support for view creation (analogous to createTableIfNotExists and friends)?
Many thanks,
-- Alastair
The text was updated successfully, but these errors were encountered: