ohmi
ohmi
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
but the tldr is you run some code to migrate to the latest migration. kysely will keep an internal database table to keep track of which migrations have alreadyt been run. migrateToLatest will only run the migrations that havent been run yet
16 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
as for running them, the docs have a section on the code for that
16 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
i name them iso8601timestamp-some-description.ts
16 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
you specify the directory where the migrations are held, and they're executed in alphabetical order. theres no specific convention on how to name them, but ISO 8601 makes sure that they're in alphabetical-chronological order
16 replies
KKysely
Created by bun on 6/29/2023 in #help
What's the pattern for writing migrations exactly?
16 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
the earliest target that compiles to async/await appears to be es2017
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
changed target to es2022, thanks!
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
that did it
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
yep
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
i assume thats a no?
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
(() => __awaiter(void 0, void 0, void 0, function* () {
console.log(yield connection
.selectFrom("available_songs")
.where("artist_aliases", "in", [])
.executeTakeFirst());
}))();
(() => __awaiter(void 0, void 0, void 0, function* () {
console.log(yield connection
.selectFrom("available_songs")
.where("artist_aliases", "in", [])
.executeTakeFirst());
}))();
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
brian@personal-vm:~/KMQ_Discord$ npx tsc
brian@personal-vm:~/KMQ_Discord$ node build/test.js
node:internal/process/promises:265
triggerUncaughtException(err, true /* fromPromise */);
^

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 'from `available_songs` where `artist_aliases` in ()' at line 1
at Packet.asError (/home/brian/KMQ_Discord/node_modules/mysql2/lib/packets/packet.js:728:17)
at Query.execute (/home/brian/KMQ_Discord/node_modules/mysql2/lib/commands/command.js:29:26)
at PoolConnection.handlePacket (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:490:32)
at PacketParser.onPacket (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:95:12)
at PacketParser.executeStart (/home/brian/KMQ_Discord/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:102:25)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at MysqlConnection.executeQuery (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/dialect/mysql/mysql-driver.js:115:69)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:37:28
at async DefaultConnectionProvider.provideConnection (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:12:20)
at async DefaultQueryExecutor.executeQuery (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16)
at async SelectQueryBuilder.execute (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1202:24)
at async SelectQueryBuilder.executeTakeFirst (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1210:26) {
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlState: '42000',
sqlMessage: "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 'from `available_songs` where `artist_aliases` in ()' at line 1",
sql: 'select from `available_songs` where `artist_aliases` in ()'
}
brian@personal-vm:~/KMQ_Discord$ npx tsc
brian@personal-vm:~/KMQ_Discord$ node build/test.js
node:internal/process/promises:265
triggerUncaughtException(err, true /* fromPromise */);
^

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 'from `available_songs` where `artist_aliases` in ()' at line 1
at Packet.asError (/home/brian/KMQ_Discord/node_modules/mysql2/lib/packets/packet.js:728:17)
at Query.execute (/home/brian/KMQ_Discord/node_modules/mysql2/lib/commands/command.js:29:26)
at PoolConnection.handlePacket (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:490:32)
at PacketParser.onPacket (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:95:12)
at PacketParser.executeStart (/home/brian/KMQ_Discord/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:102:25)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at MysqlConnection.executeQuery (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/dialect/mysql/mysql-driver.js:115:69)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:37:28
at async DefaultConnectionProvider.provideConnection (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:12:20)
at async DefaultQueryExecutor.executeQuery (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16)
at async SelectQueryBuilder.execute (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1202:24)
at async SelectQueryBuilder.executeTakeFirst (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1210:26) {
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlState: '42000',
sqlMessage: "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 'from `available_songs` where `artist_aliases` in ()' at line 1",
sql: 'select from `available_songs` where `artist_aliases` in ()'
}
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
above was with ts-node, but same when transpiling
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
import { Kysely, MysqlDialect } from "kysely";
import { createPool } from "mysql2";
import { KmqDB } from "./typings/kmq_db";

const connection = new Kysely<KmqDB>({
dialect: new MysqlDialect({
pool: createPool({
host: "127.0.0.1",
user: "",
password: "",
database: "",
connectionLimit: 10,
charset: "utf8mb4",
port: 3306,
decimalNumbers: true,
multipleStatements: true,
}),
}),
});

(async () => {
console.log(
await connection
.selectFrom("available_songs")
.where("artist_aliases", "in", [])
.execute()
);
})();
import { Kysely, MysqlDialect } from "kysely";
import { createPool } from "mysql2";
import { KmqDB } from "./typings/kmq_db";

const connection = new Kysely<KmqDB>({
dialect: new MysqlDialect({
pool: createPool({
host: "127.0.0.1",
user: "",
password: "",
database: "",
connectionLimit: 10,
charset: "utf8mb4",
port: 3306,
decimalNumbers: true,
multipleStatements: true,
}),
}),
});

(async () => {
console.log(
await connection
.selectFrom("available_songs")
.where("artist_aliases", "in", [])
.execute()
);
})();
brian@personal-vm:~/KMQ_Discord$ ts-node src/test.ts

/home/brian/KMQ_Discord/node_modules/mysql2/lib/packets/packet.js:728
const err = new Error(message);
^
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 'from `available_songs` where `artist_aliases` in ()' at line 1
at Packet.asError (/home/brian/KMQ_Discord/node_modules/mysql2/lib/packets/packet.js:728:17)
at Query.execute (/home/brian/KMQ_Discord/node_modules/mysql2/lib/commands/command.js:29:26)
at PoolConnection.handlePacket (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:490:32)
at PacketParser.onPacket (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:95:12)
at PacketParser.executeStart (/home/brian/KMQ_Discord/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:102:25)
at Socket.emit (node:events:520:28)
at Socket.emit (node:domain:475:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at MysqlConnection.executeQuery (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/dialect/mysql/mysql-driver.js:115:69)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at /home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:37:28
at DefaultConnectionProvider.provideConnection (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:12:20)
at DefaultQueryExecutor.executeQuery (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16)
at SelectQueryBuilder.execute (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1202:24)
brian@personal-vm:~/KMQ_Discord$ ts-node src/test.ts

/home/brian/KMQ_Discord/node_modules/mysql2/lib/packets/packet.js:728
const err = new Error(message);
^
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 'from `available_songs` where `artist_aliases` in ()' at line 1
at Packet.asError (/home/brian/KMQ_Discord/node_modules/mysql2/lib/packets/packet.js:728:17)
at Query.execute (/home/brian/KMQ_Discord/node_modules/mysql2/lib/commands/command.js:29:26)
at PoolConnection.handlePacket (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:490:32)
at PacketParser.onPacket (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:95:12)
at PacketParser.executeStart (/home/brian/KMQ_Discord/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/home/brian/KMQ_Discord/node_modules/mysql2/lib/connection.js:102:25)
at Socket.emit (node:events:520:28)
at Socket.emit (node:domain:475:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at MysqlConnection.executeQuery (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/dialect/mysql/mysql-driver.js:115:69)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at /home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:37:28
at DefaultConnectionProvider.provideConnection (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:12:20)
at DefaultQueryExecutor.executeQuery (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16)
at SelectQueryBuilder.execute (/home/brian/KMQ_Discord/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1202:24)
{
"compilerOptions": {
"incremental": true,
"outDir": "./build",
"allowJs": true,
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"baseUrl": ".",
"rootDir": "src",
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictPropertyInitialization": true,
"lib": ["es2022"],
"resolveJsonModule": true,
"esModuleInterop": true,
"sourceMap": true,
"skipLibCheck": true
},
"include": [
"./src/**/*"
]
}
{
"compilerOptions": {
"incremental": true,
"outDir": "./build",
"allowJs": true,
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"baseUrl": ".",
"rootDir": "src",
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictPropertyInitialization": true,
"lib": ["es2022"],
"resolveJsonModule": true,
"esModuleInterop": true,
"sourceMap": true,
"skipLibCheck": true
},
"include": [
"./src/**/*"
]
}
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
but yeah ill try to dig deeper a bit later todayu
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
oh, its possible it might be in a Promise.all?
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
i should be compiling to es6.. let me try to get a minimal repro some time tomorrow
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
heres the full stack trace, truncated it a bit earlier
2023-06-21T04:20:13.395Z [ERROR] - unhandledRejection | Cluster Unhandled Rejection | Name: Error. Reason: 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
at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:728:17)
at Query.execute (/app/node_modules/mysql2/lib/commands/command.js:29:26)
at PoolConnection.handlePacket (/app/node_modules/mysql2/lib/connection.js:490:32)
at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:95:12)
at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/app/node_modules/mysql2/lib/connection.js:102:25)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at MysqlConnection.executeQuery (/app/node_modules/kysely/dist/cjs/dialect/mysql/mysql-driver.js:115:69)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:37:28
at async DefaultConnectionProvider.provideConnection (/app/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:12:20)
at async DefaultQueryExecutor.executeQuery (/app/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16)
at async SelectQueryBuilder.execute (/app/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1202:24)
at async SelectQueryBuilder.executeTakeFirst (/app/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1210:26)
2023-06-21T04:20:13.395Z [ERROR] - unhandledRejection | Cluster Unhandled Rejection | Name: Error. Reason: 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
at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:728:17)
at Query.execute (/app/node_modules/mysql2/lib/commands/command.js:29:26)
at PoolConnection.handlePacket (/app/node_modules/mysql2/lib/connection.js:490:32)
at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:95:12)
at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/app/node_modules/mysql2/lib/connection.js:102:25)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at MysqlConnection.executeQuery (/app/node_modules/kysely/dist/cjs/dialect/mysql/mysql-driver.js:115:69)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:37:28
at async DefaultConnectionProvider.provideConnection (/app/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:12:20)
at async DefaultQueryExecutor.executeQuery (/app/node_modules/kysely/dist/cjs/query-executor/query-executor-base.js:36:16)
at async SelectQueryBuilder.execute (/app/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1202:24)
at async SelectQueryBuilder.executeTakeFirst (/app/node_modules/kysely/dist/cjs/query-builder/select-query-builder.js:1210:26)
30 replies
KKysely
Created by ohmi on 6/22/2023 in #help
Figuring out where in codebase an exception originated from
extendStackTrace should in theory be including the stack trace of where the .execute was called?
30 replies
KKysely
Created by ohmi on 5/25/2023 in #help
Using column aliases in `.where()`
woops, sorry
7 replies