We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
import { integer, pgTable, varchar } from 'drizzle-orm/pg-core'; import { PGlite } from '@electric-sql/pglite'; import { drizzle } from 'drizzle-orm/pglite'; import { app } from 'electron'; import { join } from 'path'; const DB_PATH = join(app.getPath('userData'), 'database'); const client = new PGlite(DB_PATH); const db = drizzle(client); const setting = pgTable('setting', { id: integer().primaryKey().generatedAlwaysAsIdentity(), key: varchar({ length: 255 }).notNull(), value: varchar({ length: 255 }) }); db.select() .from(setting) .then((res) => { console.log(res); });
errorUnhandledPromiseRejectionWarning: error: relation "setting" does not exist
UnhandledPromiseRejectionWarning: error: relation "setting" does not exist
The text was updated successfully, but these errors were encountered:
drizzle does not create tables automatically, you need to use drizzle-kit set migration.
Sorry, something went wrong.
this should do it
import { drizzle } from 'drizzle-orm/pglite' import { migrate } from 'drizzle-orm/pglite/migrator' // ... const databaseInstance = drizzle({ client: pgClient, schema }) export function migrateAfterClientReady() { if (!client.ready) await client.waitReady await migrate(databaseInstance, { migrationsFolder: path.resolve('src/shared/drizzle/'), // set to your drizzle generated path migrationsSchema: path.resolve('src/shared/db/schema'), // set to your schema path migrationsTable: '__migrations' }) } migrateAfterClientReady();
No branches or pull requests
error
UnhandledPromiseRejectionWarning: error: relation "setting" does not exist
The text was updated successfully, but these errors were encountered: