Aidan Laycock
Aidan Laycock
DTDrizzle Team
Created by BinaryArtifex on 7/29/2023 in #help
cannot set alias for composite primary key, getting (errno 1059) (sqlstate 42000) errors
That's amazing thank you! Do you roughly when that should be released?
13 replies
DTDrizzle Team
Created by BinaryArtifex on 7/29/2023 in #help
cannot set alias for composite primary key, getting (errno 1059) (sqlstate 42000) errors
Hey @a_sherman - Has this functionality been released? As I'm currently hitting the same issue as above, and I can't find anything in the docs about it 🙂
13 replies
DTDrizzle Team
Created by { ken } on 6/26/2023 in #help
Auto update for updated_at
Fair enough! That's good to know!
14 replies
DTDrizzle Team
Created by { ken } on 6/26/2023 in #help
Auto update for updated_at
Hey @dhruvaagrawal - How did you manage to get on with this? As I've actually hit the same problem that I'm about to start looking into.
14 replies
DTDrizzle Team
Created by Aidan Laycock on 8/17/2023 in #help
Conditional findFirst
I believe that should solve it thank you! We've just created a wrapper shorthand for some of the consistent query types we do, so we're just looking at adding things like this so that we can streamline our development.
27 replies
DTDrizzle Team
Created by xamarot on 8/17/2023 in #help
Invert a boolean easily?
You could just use the SQL operator here. (https://orm.drizzle.team/docs/sql) 🙂 That'd be the easiest way to handle this
4 replies
DTDrizzle Team
Created by Aidan Laycock on 8/11/2023 in #help
Issue with Jest tests in Next.js
For anyone coming to this in the future, I've resolved this by doing:
import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2";

async function main() {
}

const connection = mysql.createConnection({
host: process.env.DB_URL,
database: process.env.DB_NAME,
... settings,
});

export const db = drizzle(connection.promise());
import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2";

async function main() {
}

const connection = mysql.createConnection({
host: process.env.DB_URL,
database: process.env.DB_NAME,
... settings,
});

export const db = drizzle(connection.promise());
9 replies
DTDrizzle Team
Created by { ken } on 6/26/2023 in #help
Auto update for updated_at
You can add your own custom types (https://orm.drizzle.team/docs/custom-types), I think drizzle want to give you all the parts and not provide too much in an opiniated way 🙂
14 replies
DTDrizzle Team
Created by ╾━╤デ╦︻(▀̿Ĺ̯▀̿ ̿) on 8/14/2023 in #help
Need help implementing one to many relations for a table on itself
Haha, no worries! Glad it's working! 😄
13 replies
DTDrizzle Team
Created by ╾━╤デ╦︻(▀̿Ĺ̯▀̿ ̿) on 8/14/2023 in #help
Need help implementing one to many relations for a table on itself
Yes I get you, although to resolve the error you've posted I think it needs the additional info so that comments.childComments will work 🙂 I'm not 100% sure though as I've not got something to test it on right now.
13 replies
DTDrizzle Team
Created by ╾━╤デ╦︻(▀̿Ĺ̯▀̿ ̿) on 8/14/2023 in #help
Need help implementing one to many relations for a table on itself
As it will be looking for a comment_id (Or something similar) most-likely in the query to join on.
13 replies
DTDrizzle Team
Created by ╾━╤デ╦︻(▀̿Ĺ̯▀̿ ̿) on 8/14/2023 in #help
Need help implementing one to many relations for a table on itself
Won't you need to add the fields and references for this? Like you've got in parentComment?
13 replies
DTDrizzle Team
Created by Aidan Laycock on 8/11/2023 in #help
Issue with Jest tests in Next.js
Any further help would be greatly appreciated
9 replies
DTDrizzle Team
Created by Aidan Laycock on 8/11/2023 in #help
Issue with Jest tests in Next.js
Hey @angelelz - Thanks for the help with this so far! I have tried the Module update, but it hasn't resolved it, as I'm trying to access the Client file through Jest, not directly to just run migrations (I'm wanting to generate some Integration tests across a few services we're overhauling from Prisma to Drizzle).
9 replies
DTDrizzle Team
Created by { ken } on 6/26/2023 in #help
Auto update for updated_at
Could you add a custom type for this that just sets the insert value as now() / new date()?
14 replies
DTDrizzle Team
Created by Aidan Laycock on 8/11/2023 in #help
Issue with Jest tests in Next.js
Hey @angelelz, I'm not quite sure what you mean! I've just copied the client connection from the documentation
import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2/promise";

const connection = await mysql.createConnection({
host: "host",
user: "user",
database: "database",
...
});

const db = drizzle(connection);
import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2/promise";

const connection = await mysql.createConnection({
host: "host",
user: "user",
database: "database",
...
});

const db = drizzle(connection);
Which is what's throwing the error in a client.ts file.
9 replies