Skip to content

Commit

Permalink
fix: error in iDose bc of special char in uG
Browse files Browse the repository at this point in the history
  • Loading branch information
theimperious1 committed Oct 13, 2024
1 parent cf1d8e4 commit 279835a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/global/commands/g.idose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ async function iDoseSet(
update: {},
});

if (units.toString() === 'µG') {
units = 'MICRO_G';

Check failure on line 151 in src/global/commands/g.idose.ts

View workflow job for this annotation

GitHub Actions / Lint

Assignment to function parameter 'units'
}

Check failure on line 153 in src/global/commands/g.idose.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
await db.user_drug_doses.create({
data: {
user_id: userData.id,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Warnings:
- The values [µG] on the enum `drug_mass_unit` will be removed. If these variants are still used in the database, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "drug_mass_unit_new" AS ENUM ('MG', 'ML', 'uG', 'G', 'OZ', 'FLOZ');
ALTER TABLE "user_drug_doses" ALTER COLUMN "units" TYPE "drug_mass_unit_new" USING ("units"::text::"drug_mass_unit_new");
ALTER TYPE "drug_mass_unit" RENAME TO "drug_mass_unit_old";
ALTER TYPE "drug_mass_unit_new" RENAME TO "drug_mass_unit";
DROP TYPE "drug_mass_unit_old";
COMMIT;
2 changes: 1 addition & 1 deletion src/prisma/tripbot/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ enum drug_category_type {
enum drug_mass_unit {
MG
ML
MICRO_G @map("µG")
MICRO_G @map("uG")
G
OZ
FLOZ
Expand Down

0 comments on commit 279835a

Please sign in to comment.