Ad hoc custom column type
Creating a table within a schema using a column from a table in another schema
Guidance to create a generic wrapper over Kysely
Kysely
instance, a database table name and an array of column names.
- The function will return an authenticator instance you can use to perform user lookups during Login. The internals of this function are not important for this discussion.
...Any way to docutype a Column as `@deprecated`?
@deprecated
type identifier in the Table type definition comments to be used in queries, is there a way to make it work with Kysely?Help with CTE query
Error this query cannot be compiled to SQL
``
await trx.executeQuery(
sql<any>
ALTER SCHEMA ${current.subdomain} RENAME TO ${subdomain};`...``ts
await sql
.raw(
ALTER SCHEMA "${current.subdomain}" RENAME TO "${subdomain}"`)
.execute(trx)...Object literal may only specify known properties, and 'clientId' does not exist in type 'InsertObjec
Reuse subquery selects
myUnion().as('u')
Use JSON key as text
->
to ->>
, doh!Typing issue when working with onConflict
Json
to string
. This is something Kysely should handle, but it's really difficult in that case. What I'd do is this
```ts
export type Json = ColumnType<
JsonValue,...getting Error: relation "myschema.kysely_migration_lock" does not exist
Error: relation "myschema.kysely_migration_lock" does not exist
.
Do I have to create the kysely tables manually to be able to run the migrator?
I would have expected that the migrator creates these tables when they do not exist....What is easiest way to get count alongside data for pagination?
SELECT COUNT(id) from table_name
. is this legit?Reusable CTEs that depend on previous CTEs
eligibleChats
instead of chatMessages
, then you can do it like this
QueryCreator<DB & { eligibleChats: { chatId: string } }>
QueryCreator<DB & { eligibleChats: { chatId: string } }>
`update set from`
update set from
sql syntax. So far, I've been unable to figure out how (in lieu of dropping down to raw sql).
We are planning to craft many of our update statements as batch operations in our repository layer, so this pattern will be used heavily.
Here's some example sql to make it clear (hopefully) what I'm trying to do...Are JSON Arrays not supported for paramterization in the postgres driver?
string
, everything works correctly. The row type is inferred correctly for output data.
https://kyse.link/?p=s&i=NBfnbfzwNBlZ0YJpc7dj...Combining selectAll and arbitrary expressions
selectAll
(for selecting all columns of a couple of tables) and then add a couple of expressions like jsonArrayFrom
on top of that?select
and selectAll
as many times as you want. The calls are additiveHow to plugin column aliases with table prefix?
.selectAll('t1', 'prefix_t1')
.selectAll('t1', 'prefix_t1')
Query building optimization question
eb
. If I have a conditional select query, is this efficiently using the eb
object for my query? Is it ok to use multiple levels of eb
s ?
```ts
// some input
args = {
param: ['foo', 'bar']...Why is eb inferred as any in this update query?
eb
variable in its expression builder. If I change the where clause to an eb callback, it does properly infer the type, which makes me concerned I'm not doing this correctly.
Am I doing something wrong? Is this a minor typing bug?
Here's the code example:...