is this uuid() correct in mysql?
aliases vs strict mode in tsconfig
DB
as a whole and when trying to figure out if an alias was used we compare against ${T} as {string}
.Kysely origin
coalesce in where statement
Which approach is better for coalesce and similar functions?
Single source of truth (defaultAlias-schema-tableName)
What's the pattern for writing migrations exactly?
kysely
's GitHub repo example, the migration files have dates, but those files aren't generated, so where did the dates come from ?
Well, let's say I don't want the migration files to have dates then I just create separate files for migrations and name them whatever? Ok, then how do I run them? Do I run them everytime the program starts ? Just help me out here, the docs doesn't mention anything about migrations I think it just assumes you are familiar with them already.....writing a transaction that calls functions
how to search inside a json type column, I'm using postgresql
How to inject parentheses in the generated arithmetic expression?
.withSchema() and raw SQL
sql <ReturnType> SELECT some_function(param);.execute(db)
the function is not found because it doesn't exist in the public
schema, although db
was created with .withSchema('myschema')
.
If I change the call to SELECT myschema.some_function(param);.execute(db)
it still doesn't work, because the function references tables in myschema
...JSON in columns (postgresql)
language
column and want to set a default value for the locale
key...Escaped paramaters in raw sql
``ts
export async function getRandomAnswerByQuestionId({ questionId, answerLimit }: { questionId: string, answerLimit: number }) {
return sql
SELECT * FROM get_random_answers(${sql.val(questionId)}, ${sql.val(answerLimit)})`.execute(databaseClient);
}...sql.val
in this case
https://kyse.link/?p=s&i=MEBVYcJHvb7Uj4c6chaI...Should database tables mimic form fields?
Best practice around building query functions
Declaring types under 'kysely-codegen' module
./types/kysely-codegen.d.ts
file which contains ```ts
import { Insertable, Selectable, Updateable } from 'kysely';
import { User } from 'kysely-codegen';...From Prisma Model to Kysely Schema
[ERR_UNKNOWN_FILE_EXTENSION] when running migrations
Figuring out where in codebase an exception originated from
.execute()
call threw a SQL exception? I know ideally I should be doing error handling on each call, but I have a large codebase and I'm not sure where this error is coming from. Is there any easy way of figuring this out? Maybe a way to have a wrapper that prints out the query if malformed, or to print out the stack trace where the original call was executed?
```
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1. Trace: Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1...How to insert into all values (and columns) from another table / view?