Is there a way to execute parameterized SQL (with paremeters) within a kysely migration?
Typing enums
enums
. I create the role
table as an "enum" table (which I got from another help post I was reading earlier) and add it as an foreign key to the teacher
table.
```ts...Any update on all migrations in single-transaction?
V0.28 Type Issues
npm i https://pkg.pr.new/kysely-org/kysely@1278
Unioning an array of sql`{SQL_QUERY}`
UNION ALL
together - any idea how best to do that? Note - the length of the query array is dynamic - Thanks!!Identically named columns in multiple tables - How to use innerJoin.selectAll()?
selectAll
on 1 table (selectAll('tables')
) and then select
the other table/s columns while aliasing columns that exist multiple "tables"....Type safe discriminated union query
$castTo
assertions I have added are hurting type safety.
If I remove .$castTo<unknown>()
in the task query I get this error in the event query Property 'description' is missing in type '{ event_name: string; }' but required in type '{ description: string; }'
, and similar in the note query....Improving TS compile speed with multiple conditional selects?
include
object that determines whether to include various optional fields. Some endpoints have grown to accept 5-10 optional fields.
Each of these optional fields results in an additional $if
branch in the Kysely query. And this seems to harm TS compile speed -- I'm now waiting 1-3min for each compilation.
What are the best ways to mitigate the compile speed downsides of using many $if
calls?...Type safety in checkExpression in addCheckConstraint
Trouble with dynamically allocating table name via string
Dynamic expression builder using raw SQL for WHERE column LIKE string% OR
const condition = dirPaths.map((dir) =>
sql<boolean>`file_path LIKE ${dir + '%'}`)
.reduce((acc, condition) => sql<boolean>`${acc} OR ${condition}`);
const condition = dirPaths.map((dir) =>
sql<boolean>`file_path LIKE ${dir + '%'}`)
.reduce((acc, condition) => sql<boolean>`${acc} OR ${condition}`);
How to define multiple configs in a NX monorepo?
kysely init
it creates the kysely.config.ts in the root ./config. Should I use conditional app selection by env variables?Making Updateable<X> fields required
UpdateableActivity
it shows:
```ts...ilike with reference
WHERE groups.group_name ILIKE '%' || users.first_name || '%'
WHERE groups.group_name ILIKE '%' || users.first_name || '%'
sql`'%'`,
sql`'%'`,
eb.val("%")
. Any other ways to make this more ergonomic?...Issue with how timestamptz is returned depending on main or subquery
timestamptz
type column
When I grab the lesson as followed:
```ts...pg
just parses the JSON object without checking strings if they represent timestamps and it doesn't get any metadata related to the contents of the JSON. That'll be quite slow as a default, to check those strings.select expression helper
tuple() and refTuple() questions
DELETE FROM table WHERE (col1,col2,col3) IN (...insert values);
i found out from my code editor intellisense that tuple()
and refTuple()
exist, but to my surprise, i can only insert 2 values in a single tuple.
is there a way for me to achieve that in kysely? or do i stick to raw sql for that?
...Casting part of a return type
SELECT
statement on a numeric field, but pg will parse this to a string. I want to be able to tell this in my output.
- I can't use $.castTo
because this destroys the other values in my SELECT
clause....Execute RAW Sql Queries
kysely
? i could not find any such function in the docs or the guide book
for example, describe table_name
errors because kysely itself cannot compile it. i am using mysql2
as my driver....await sql`RAW QUERY HERE;`.execute(db);
await sql`RAW QUERY HERE;`.execute(db);
Selecting result of subtraction with summation
"inventory.initial_quantity"
, rather than wrapping it in eb.val
🤦♂️