You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On initialization, db.schema returns undefined
Here is my code:
Database.ts
import { Database } from './types'; // this is the Database interface we defined earlier
import { createPool } from 'mysql'; // do not use 'mysql2/promises'!
import { Kysely, MysqlDialect } from 'kysely';
const dialect = new MysqlDialect({
pool: createPool({
database: 'my_db',
host: '127.0.0.1',
user: 'username',
password: 'password',
port: 3308,
connectionLimit: 10
})
});
export const db = new Kysely<Database>({
dialect
});
On checking, db.schema gives me undefined
I'm using mysql as the dialect
And using the following versions for mysql and kysely:
"kysely": "^0.27.3",
"mysql": "^2.18.1"
The text was updated successfully, but these errors were encountered:
import { Database } from './types'; // this is the Database interface we defined earlier
import { createPool } from 'mysql2'; // do not use 'mysql2/promises'!
import { Kysely, MysqlDialect } from 'kysely';
const dialect = new MysqlDialect({
pool: createPool({
database: 'my_db',
host: '127.0.0.1',
user: 'username',
password: 'password',
port: 3308,
connectionLimit: 10
})
});
export const db = new Kysely<Database>({
dialect
});
Got it, the issue has been resolved. It was stupid issue from my end. I was importing the db from the database file as default import, hence it was not working. My bad!
On initialization, db.schema returns undefined
Here is my code:
Database.ts
On checking, db.schema gives me undefined
I'm using mysql as the dialect
And using the following versions for mysql and kysely:
"kysely": "^0.27.3",
"mysql": "^2.18.1"
The text was updated successfully, but these errors were encountered: