Create conditional cte insert query
Is it possible to configure to which types database columns are introspected?
int id
is introspected to Generated<number>
(we would like number type) or decimals
are introspected to Numeric
(we would like just number)How to infer an aggregated column with `filterWhere` clause as nullable?
leftJoin
, then grouping rows by id, and finally using jsonAgg(jsonBuildObject(...))
with a filterWhere
method chained on top of this expression as seen in the demo.
The problem is that the inferred type by kysely is incorrect, because it thinks the json aggregate function will always be an array, however, if there are no matching rows from the other table it will be NULL because of the filter where clause....defineConfig using --environment type issue with seedFolder
Accessing underlying methods on the client
Kysely
class itself, or if it is necessary for me to write my own extension of the class to achieve thisIs there an easy tool to convert my existing knex migrations to kysely migrations?
What am I not understanding about ColumnType?
How to do `LIKE ANY` query in Kysely?
ANY
into the query.
```sql
SELECT *
FROM your_table
WHERE your_column LIKE ANY (ARRAY[...Creating snippets (best pratice)
How to order by desc using expression builder with case
desc
to the eb.
```ts
const person = await db
.selectFrom("person")...Is it possible to do "for await (const iterator of db.selectFrom("table").selectAll()) {....}
Question about ColumnTypes and dates.
DATE
(yyyy-mm-dd).
```sql
CREATE TABLE IF NOT EXISTS person(
id INT NOT NULL,...ColumnType
which would be used in where
statements (and other similar statements).
But then subqueries in where
statements would break if the select type and the query type don't match....How to type tables with dynamic names?
.withTables
and in the queries, and implement a plugin that on-the-fly adds the random suffix to all references to that table....clone select query
Any limits on insertValues(array)?
Migration to seed huge amount of data
Creating a jsonAgg helper funtcion that returns a context aware `AggregateFunctionBuilder`
eb.fn.jsonAgg
does but for JSONB.
- I have tried using the helpers/postgres/jsonArrayFrom
, but that is functionally not the same because it creates a subquery.
- I have tried creating a simple helper, but it's not type/context aware, and it doesn't support method chaining (.distinct()
for example):
...How to add array column in migrations?
.addColumn('countyNames', sql`varchar[]`)
.addColumn('countyNames', sql`varchar[]`)
are conditional CTEs possible?
Type 'QueryCreatorWithCommonTableExpression ... The types returned by 'with(...)' are incompatible between these types.
...