NinjaBunny
NinjaBunny
Explore posts from servers
DTDrizzle Team
Created by NinjaBunny on 4/17/2024 in #help
Everything is optional
No description
1 replies
DTDrizzle Team
Created by NinjaBunny on 3/10/2024 in #help
Programmatically get columns from table
No description
3 replies
DTDrizzle Team
Created by NinjaBunny on 9/5/2023 in #help
extract table names from db.query
Hi all, I want to extract the name of a table like this this.db.query however if I were to do this
type model = typeof this.db.query
type model = typeof this.db.query
it gives me a readonly version of what I really want, and because my goal is to do something like this
async findById(id: Id) {
return await this.db.query[<dynamic key>].findFirst({});
}
async findById(id: Id) {
return await this.db.query[<dynamic key>].findFirst({});
}
however this is unsuccessful because the when I try to use the type Model from above it gets angry because this.db.query[model].findFirst gives me the readonly value, but I want a non readonly value so I can use it properly. Any help is appreciated
2 replies
DTDrizzle Team
Created by NinjaBunny on 9/5/2023 in #help
implementing generics with crud and classes
3 replies
DTDrizzle Team
Created by NinjaBunny on 7/1/2023 in #help
Error when trying to generate a migration schema
anyone any ideas to what the problem is? It was working fine yesterday and now it throws an error when I am trying to generate a migration file. I was updating the relationships/adding a new table and when I tried generate a migration file, this error appeared this is the script i'm running "generate": "cross-env NODE_ENV=development drizzle-kit generate:pg --config=drizzle.config.ts",
import { Config } from "drizzle-kit";

export default {
schema: "./src/modules/drizzle/schemas",
driver: "pg",
dbCredentials: {
connectionString: `postgres://${process.env.PG_USER}:${
process.env.PG_PASSWORD
}@${process.env.PG_HOST}${
process.env.NODE_ENV === "docker" ? `:${process.env.PG_PORT}` : ""
}/${process.env.PG_DATABASE}`,
},
out: "./.drizzle",
} satisfies Config;
import { Config } from "drizzle-kit";

export default {
schema: "./src/modules/drizzle/schemas",
driver: "pg",
dbCredentials: {
connectionString: `postgres://${process.env.PG_USER}:${
process.env.PG_PASSWORD
}@${process.env.PG_HOST}${
process.env.NODE_ENV === "docker" ? `:${process.env.PG_PORT}` : ""
}/${process.env.PG_DATABASE}`,
},
out: "./.drizzle",
} satisfies Config;
``` Reading config file '/munchies/server/drizzle.config.ts' Error: Transform failed with 1 error: errors: [ { detail: undefined, id: '', location: [Object], notes: [], pluginName: '', text: 'Transforming JavaScript decorators to the configured target environment ("es2021") is not supported yet' } ], warnings: [] }
6 replies
DTDrizzle Team
Created by NinjaBunny on 6/17/2023 in #help
dynamic relational queries column returns
1 replies