brettlyc
DTDrizzle Team
•Created by brettlyc on 9/19/2024 in #help
transaction is not defined
When calling
it returns an error
This is my db file
However, everything else works..
const transaction = await db.transaction()
const transaction = await db.transaction()
TypeError: transaction is not a function
TypeError: transaction is not a function
const { drizzle } = require('drizzle-orm/node-postgres')
const { Client } = require('pg')
const { vehicles } = require('#schemas/vehicles.js')
const { technicianSchedules } = require('#schemas/technician_schedules.js')
const { stores } = require('#schemas/stores.js')
const { services } = require('#schemas/services.js')
const { technicians } = require('#schemas/technicians.js')
const { appointments } = require('#schemas/appointments.js')
const { zipcodes } = require('#schemas/zipcodes.js')
const { email_templates } = require('#schemas/email_templates.js')
const { emails } = require('#schemas/emails.js')
const { email_tracking } = require('#schemas/email_tracking.js')
const client = new Client({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false
}
})
client.connect(null).then(() => console.log('The Database has been connected, successfully.'))
module.exports = {
db: drizzle(client, {
schema: {
vehicles,
technicianSchedules,
stores,
services,
technicians,
appointments,
zipcodes,
email_templates,
emails,
email_tracking
}
}),
client
}
const { drizzle } = require('drizzle-orm/node-postgres')
const { Client } = require('pg')
const { vehicles } = require('#schemas/vehicles.js')
const { technicianSchedules } = require('#schemas/technician_schedules.js')
const { stores } = require('#schemas/stores.js')
const { services } = require('#schemas/services.js')
const { technicians } = require('#schemas/technicians.js')
const { appointments } = require('#schemas/appointments.js')
const { zipcodes } = require('#schemas/zipcodes.js')
const { email_templates } = require('#schemas/email_templates.js')
const { emails } = require('#schemas/emails.js')
const { email_tracking } = require('#schemas/email_tracking.js')
const client = new Client({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false
}
})
client.connect(null).then(() => console.log('The Database has been connected, successfully.'))
module.exports = {
db: drizzle(client, {
schema: {
vehicles,
technicianSchedules,
stores,
services,
technicians,
appointments,
zipcodes,
email_templates,
emails,
email_tracking
}
}),
client
}
11 replies