skuse
skuse
Explore posts from servers
DTDrizzle Team
Created by skuse on 4/20/2024 in #help
NaN primary keys + not honouring camelCase table names
No description
4 replies
DTDrizzle Team
Created by skuse on 3/13/2024 in #help
Support socket path drizzle.config.ts
Hey, I have been prototyping my database in a local environment using mysql2. Everything is compatible with drizzle apart from drizzle studio. In the db credentials object, there doesn't seem to be an option to specify socketPath like there is in the native mysql2 object.
import type { Config } from "drizzle-kit";
import * as dotenv from "dotenv";

dotenv.config({
path: ".env",
});

export default {
schema: "src/db/schema.ts",
driver: "mysql2",
out: "src/db",
verbose: true,

dbCredentials: {
//@ts-ignore
socketPath: process.env.DB_SOCKET_PATH as string,
host: "127.0.0.1",
uri: process.env.DB_URL as string,
},
strict: true,
tablesFilter: [`${process.env.DB_TABLES_FILTER as string}*`],

breakpoints: true,
} satisfies Config;
import type { Config } from "drizzle-kit";
import * as dotenv from "dotenv";

dotenv.config({
path: ".env",
});

export default {
schema: "src/db/schema.ts",
driver: "mysql2",
out: "src/db",
verbose: true,

dbCredentials: {
//@ts-ignore
socketPath: process.env.DB_SOCKET_PATH as string,
host: "127.0.0.1",
uri: process.env.DB_URL as string,
},
strict: true,
tablesFilter: [`${process.env.DB_TABLES_FILTER as string}*`],

breakpoints: true,
} satisfies Config;
as a result, studio can't connect to the database (ECONNREFUSED ::1:3306)
1 replies
DTDrizzle Team
Created by skuse on 8/8/2023 in #help
Cant drop key mysql
When adding a new key and pushing to DB, it will not allow you to drop the key and push to db.
3 replies
DTDrizzle Team
Created by skuse on 8/4/2023 in #help
onDuplicateKeyUpdate
Is this the correct way to use this method? Can't find documentation
.insert(schema.item)
.values({
id: message.data.id, //primary key
itemStatus: "new"
})
.onDuplicateKeyUpdate({
set: {
itemStatus: "old"
},
});
.insert(schema.item)
.values({
id: message.data.id, //primary key
itemStatus: "new"
})
.onDuplicateKeyUpdate({
set: {
itemStatus: "old"
},
});
1 replies
DTDrizzle Team
Created by skuse on 8/3/2023 in #help
Dropping unique constraint cant push to db
I have this key here nftCollectionIdKey: unique("Pool_nftCollectionId_key").on( table.nftCollectionAddress ), This is the only place the key appears and my database is blank. I should be able to drop the unique constraint right? Im getting this error: 'Pool_nftCollectionId_key' is not found in the table. (errno 3821) (sqlstate HY000) (CallerID: ####): Sql: "alter table Pool drop check Pool_nftCollectionId_key", BindVars: {REDACTED}` When I add the key back and push it works.
2 replies
TTCTheo's Typesafe Cult
Created by skuse on 3/23/2023 in #questions
Prisma p.account.create() error "Column: for"
When I sign in with discord, it works fine, when I sign in with spotify, I get this error: "The provided value for the column is too long for the column's type. Column: for" I dont have a column "for" in my schema. Prisma creates a new user table, but cant create an account for the user. I just switched from SQLite to MySQL, I know the solution would be to make the "for" column longer, but I dont know where the "for" column is
2 replies
TTCTheo's Typesafe Cult
Created by skuse on 1/10/2023 in #questions
Environment variables pass on backend but fail on client?
4 replies