Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uG option being broken in /idose set #854

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/global/commands/g.idose.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { drug_mass_unit, drug_roa } from '@prisma/client';
import { $Enums, drug_mass_unit, drug_roa } from '@prisma/client';
import {
time,
} from 'discord.js';
Expand Down Expand Up @@ -153,7 +153,7 @@ async function iDoseSet(
drug_id: drugId,
route: roa,
dose: volume,
units,
units: units.toString() === 'µG' ? $Enums.drug_mass_unit.MICRO_G : units,
created_at: date,
},
});
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
Loading