Planetscale swapped the order of Primary Key Relation

Hey, running into this weird issue when using Drizzle push on a staging branch of Planetscale, trying to promote it to production In the screenshot you can see: - PRIMARY KEY (userId, serverId), + PRIMARY KEY (serverId, userId), Which is causing an issue with the deployment being blocked - Is there any way I can make Drizzle go back to how it was originally doing the relations? I tried reordering the variables but that didn't change anything
export const dbUserServerSettings = mysqlTable(
'UserServerSettings',
{
userId: varchar('userId', { length: 191 }).notNull(),
serverId: varchar('serverId', { length: 191 }).notNull(),
bitfield: unsignedInt('bitfield').default(0).notNull(),
},
(table) => {
return {
userIdIdx: index('UserServerSettings_userId_idx').on(table.userId),
serverIdIdx: index('UserServerSettings_serverId_idx').on(table.serverId),
userServerSettingsUserIdServerId: primaryKey(
table.userId,
table.serverId,
),
};
},
);
export const dbUserServerSettings = mysqlTable(
'UserServerSettings',
{
userId: varchar('userId', { length: 191 }).notNull(),
serverId: varchar('serverId', { length: 191 }).notNull(),
bitfield: unsignedInt('bitfield').default(0).notNull(),
},
(table) => {
return {
userIdIdx: index('UserServerSettings_userId_idx').on(table.userId),
serverIdIdx: index('UserServerSettings_serverId_idx').on(table.serverId),
userServerSettingsUserIdServerId: primaryKey(
table.userId,
table.serverId,
),
};
},
);
Thanks
No description
1 Reply
Rhys
RhysOP15mo ago
Actually I don't think this is a Drizzle issue, I think this is just the first time I'm pushing with Drizzle to a database that was made before Drizzle Having some way to control the order of the foregin keys would be helpful though for this scenario - I tried
sql`PRIMARY KEY (`userId`, `serverId`)`/
sql`PRIMARY KEY (`userId`, `serverId`)`/
on a whim and that didn't work
Want results from more Discord servers?
Add your server