Dizzle Kit: Push altering unchanged column

CREATE TABLE `economy_profiles` (
`member_id` bigint unsigned NOT NULL,
`guild_id` bigint unsigned NOT NULL,
`wallet` int unsigned NOT NULL,
`bank` int unsigned NOT NULL,
`safe` int unsigned NOT NULL,
- `bank_level` tinyint unsigned NOT NULL DEFAULT '0',
- `safe_level` tinyint unsigned NOT NULL DEFAULT '0',
+ `bank_level` tinyint unsigned NOT NULL,
+ `safe_level` tinyint unsigned NOT NULL,
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
PRIMARY KEY (`member_id`, `guild_id`),
UNIQUE KEY `economy_profiles_member_id_guild_id_unique` (`member_id`, `guild_id`),
UNIQUE KEY `member_id_guild_id_idx` (`member_id`, `guild_id`)
) ENGINE InnoDB,
CHARSET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
CREATE TABLE `economy_profiles` (
`member_id` bigint unsigned NOT NULL,
`guild_id` bigint unsigned NOT NULL,
`wallet` int unsigned NOT NULL,
`bank` int unsigned NOT NULL,
`safe` int unsigned NOT NULL,
- `bank_level` tinyint unsigned NOT NULL DEFAULT '0',
- `safe_level` tinyint unsigned NOT NULL DEFAULT '0',
+ `bank_level` tinyint unsigned NOT NULL,
+ `safe_level` tinyint unsigned NOT NULL,
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
PRIMARY KEY (`member_id`, `guild_id`),
UNIQUE KEY `economy_profiles_member_id_guild_id_unique` (`member_id`, `guild_id`),
UNIQUE KEY `member_id_guild_id_idx` (`member_id`, `guild_id`)
) ENGINE InnoDB,
CHARSET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
I will push this to planetscale. I run the push again without doing anything and this happens:
CREATE TABLE `economy_profiles` (
`member_id` bigint unsigned NOT NULL,
`guild_id` bigint unsigned NOT NULL,
`wallet` int unsigned NOT NULL,
`bank` int unsigned NOT NULL,
`safe` int unsigned NOT NULL,
- `bank_level` tinyint unsigned NOT NULL,
- `safe_level` tinyint unsigned NOT NULL,
+ `bank_level` tinyint unsigned NOT NULL DEFAULT '0',
+ `safe_level` tinyint unsigned NOT NULL DEFAULT '0',
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
PRIMARY KEY (`member_id`, `guild_id`),
UNIQUE KEY `economy_profiles_member_id_guild_id_unique` (`member_id`, `guild_id`),
UNIQUE KEY `member_id_guild_id_idx` (`member_id`, `guild_id`)
) ENGINE InnoDB,
CHARSET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
CREATE TABLE `economy_profiles` (
`member_id` bigint unsigned NOT NULL,
`guild_id` bigint unsigned NOT NULL,
`wallet` int unsigned NOT NULL,
`bank` int unsigned NOT NULL,
`safe` int unsigned NOT NULL,
- `bank_level` tinyint unsigned NOT NULL,
- `safe_level` tinyint unsigned NOT NULL,
+ `bank_level` tinyint unsigned NOT NULL DEFAULT '0',
+ `safe_level` tinyint unsigned NOT NULL DEFAULT '0',
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
PRIMARY KEY (`member_id`, `guild_id`),
UNIQUE KEY `economy_profiles_member_id_guild_id_unique` (`member_id`, `guild_id`),
UNIQUE KEY `member_id_guild_id_idx` (`member_id`, `guild_id`)
) ENGINE InnoDB,
CHARSET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
5 Replies
PAdventures
PAdventuresOP12mo ago
also it keeps trying to do this when i dont change things and i can see that these have been done in my planetscale insights
ALTER TABLE `economy_profiles` DROP PRIMARY KEY;
ALTER TABLE `levels` DROP PRIMARY KEY;
ALTER TABLE `logs` DROP PRIMARY KEY;
ALTER TABLE `rolesToUsers` DROP PRIMARY KEY;
ALTER TABLE `tickets` DROP PRIMARY KEY;
ALTER TABLE `users` DROP PRIMARY KEY;
ALTER TABLE `economy_profiles` MODIFY COLUMN `bank_level` tinyint unsigned NOT NULL;
ALTER TABLE `economy_profiles` MODIFY COLUMN `safe_level` tinyint unsigned NOT NULL;
ALTER TABLE `shops` MODIFY COLUMN `items` tinyint unsigned NOT NULL;
ALTER TABLE `shops_config` MODIFY COLUMN `max_allowed` tinyint unsigned NOT NULL DEFAULT 2;
ALTER TABLE `shops_config` MODIFY COLUMN `max_items` tinyint unsigned NOT NULL DEFAULT 10;
ALTER TABLE `tickets` MODIFY COLUMN `rating` tinyint unsigned;
ALTER TABLE `tickets_config` MODIFY COLUMN `max_open` tinyint unsigned NOT NULL;
ALTER TABLE `economy_profiles` ADD PRIMARY KEY(`member_id`,`guild_id`);
ALTER TABLE `levels` ADD PRIMARY KEY(`member_id`,`guild_id`);
ALTER TABLE `logs` ADD PRIMARY KEY(`guild_id`,`channel_id`,`log_type`,`log_sub_type`);
ALTER TABLE `rolesToUsers` ADD PRIMARY KEY(`guild_id`,`role_id`,`user_id`);
ALTER TABLE `tickets` ADD PRIMARY KEY(`id`,`guild_id`);
ALTER TABLE `users` ADD PRIMARY KEY(`id`,`guild_id`);
ALTER TABLE `economy_profiles` DROP PRIMARY KEY;
ALTER TABLE `levels` DROP PRIMARY KEY;
ALTER TABLE `logs` DROP PRIMARY KEY;
ALTER TABLE `rolesToUsers` DROP PRIMARY KEY;
ALTER TABLE `tickets` DROP PRIMARY KEY;
ALTER TABLE `users` DROP PRIMARY KEY;
ALTER TABLE `economy_profiles` MODIFY COLUMN `bank_level` tinyint unsigned NOT NULL;
ALTER TABLE `economy_profiles` MODIFY COLUMN `safe_level` tinyint unsigned NOT NULL;
ALTER TABLE `shops` MODIFY COLUMN `items` tinyint unsigned NOT NULL;
ALTER TABLE `shops_config` MODIFY COLUMN `max_allowed` tinyint unsigned NOT NULL DEFAULT 2;
ALTER TABLE `shops_config` MODIFY COLUMN `max_items` tinyint unsigned NOT NULL DEFAULT 10;
ALTER TABLE `tickets` MODIFY COLUMN `rating` tinyint unsigned;
ALTER TABLE `tickets_config` MODIFY COLUMN `max_open` tinyint unsigned NOT NULL;
ALTER TABLE `economy_profiles` ADD PRIMARY KEY(`member_id`,`guild_id`);
ALTER TABLE `levels` ADD PRIMARY KEY(`member_id`,`guild_id`);
ALTER TABLE `logs` ADD PRIMARY KEY(`guild_id`,`channel_id`,`log_type`,`log_sub_type`);
ALTER TABLE `rolesToUsers` ADD PRIMARY KEY(`guild_id`,`role_id`,`user_id`);
ALTER TABLE `tickets` ADD PRIMARY KEY(`id`,`guild_id`);
ALTER TABLE `users` ADD PRIMARY KEY(`id`,`guild_id`);
[email protected] [email protected] ^ those are my versions Looks like the newest version may not have fixed the pk droping and creating for planetscale maybe? idk
Angelelz
Angelelz12mo ago
@Andrew Sherman
PAdventures
PAdventuresOP12mo ago
Is there anything I can do to work around this, or is this a bug that must be fixed?
Angelelz
Angelelz12mo ago
You can use migration files. That way you can monitor them and alter them as needed I believe there's a way to only print the push command without applying it, that could be another way, just apply them manually in the console I think it's the strict option, will only print the statements and you have to approve them Make sure you do it on the developmen branch to avoid mistakes
PAdventures
PAdventuresOP12mo ago
Ok, thank you for the advice. If you are making a fix for this. i just looked and all of these queries are being run when the table already is in those configuations so all of those queries are not necessary Did the latest drizzle-kit update try to fix this issue? if not please ignore me. If so, I've updated my drizzle and nothing changed
Want results from more Discord servers?
Add your server