francel
Explore posts from serversDTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
ah ok, really thank you thank you very much, thank you very much. God bless you for your help. I followed the documentation and it is not shown in the documentation that it is also necessary to import the relationships.
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
what can i do ?
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
what can i do ?
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
I changed to using this, but I still get the same error. all the other queries pass, but the one with the with: still doesn't work for me
// node-postgres
import { drizzle } from "drizzle-orm/node-postgres";
import pg from "pg";
import * as schema from './schema/index';
const client = new pg.Client({
connectionString: process.env.DATABASE_URL_DRIZZLE_ORM,
});
(async () => {
try {
await client.connect();
} catch (error) {
console.log(error);
await client.end();
}
})();
export const db = drizzle(client, { schema, logger: true });
// node-postgres
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
So ise use import Pool from 'pg-pool'
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
SyntaxError: The requested module 'pg' does not provide an export named 'Client'
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
i get this error
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
When i use import { Client } from "pg";
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
{ Client } from 'pg' not working, so i use import Pool from 'pg-pool'
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
// node-postgres
import { drizzle } from "drizzle-orm/node-postgres";
// import { Client } from "pg";
import Pool from 'pg-pool'
import * as schema from './schema/index';
// const client = new Client({
// connectionString: process.env.DATABASE_URL,
// });
// await client.connect();
// export const db = drizzle(client);
const pool = new Pool({
connectionString: process.env.DATABASE_URL_DRIZZLE_ORM,
});
export const db = drizzle(pool, { schema, logger: true });
// node-postgres
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
I really feel like I wasted all my time migrating from prisma to drizzle.
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
yes, but why the query not working when i use with: to include the relation. https://orm.drizzle.team/docs/rqb#include-relations
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
Should we import the relationships? to use them where for example?
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
I use npm run drizzle-kit push:pg to execute migration
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
I use npm run drizzle-kit generate:pg to generate migration
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
I just follow documentation
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
// index.ts
export { ads } from './ads'
export { users } from './users'
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
// users.ts
import { ads } from './index'
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
// ads.ts
import { users } from './index'
38 replies
DTDrizzle Team
•Created by francel on 11/2/2023 in #help
Cannot read properties of undefined (reading 'referencedTable')
export const users = pgTable("users", {
// id: serial("id"),
// id: serial('id').primaryKey(),
id: uuid('id').defaultRandom().notNull().primaryKey(),
// name: text("name"),
// fullName: text('full_name').unique(),
// phone: varchar('phone', { length: 256 }),
email: varchar("email").unique(),
});
export const usersRelations = relations(users, ({ many }) => ({
ads: many(ads),
}));
38 replies