brettlyc
brettlyc
DTDrizzle Team
Created by brettlyc on 9/19/2024 in #help
transaction is not defined
When calling
const transaction = await db.transaction()
const transaction = await db.transaction()
it returns an error
TypeError: transaction is not a function
TypeError: transaction is not a function
This is my db file
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
}
However, everything else works..
11 replies