Notes
keys
Need to keep track of these keys:
portainer_stack
- Addedjwt_secret
- Addedportainer
- Addedhcaptcha
- Addedkbve
- Addedshieldwall
- Added
Hosts
Need to extend the hosts table.
2024
-
11:30am -
Schema
Schema
Starting off the weekend with more schema changes! Finalize the message table and then expand out the host table, but before doing those two tables, I need to make sure the global keys are added. It seems that during the
dbmodels.rs
generation under theerust
folder, the struct derives seem to fail, thus I need to see why it fails. The original shell uses sed to replace(Queryable, Debug, Identifiable)
but since we shifted the primarykey back to serial / big int instead of binary, we no longer need theIdentfiable
! Thus going to remove that aspect of the schema generation.In addition, there would be the zod that we need to expand.
export const registerUserSchema = z.object({ username: z.string(), email: z.string(), password: z.string(), confirmPassword: z.string(), }); export function registerUserSchemaValidation(schema: ZodRawShape) { return registerUserSchema .extend(schema) .refine((data) => data.password === data.confirmPassword, { message: "Passwords do not match", path: ["confirmPassword"], }) .refine((data) => /^[a-zA-Z0-9]+$/.test(data.username) && data.username.length >= 3 && data.username.length <= 20, { message: "Username must be 3-20 characters long and only contain alphanumeric characters", path: ["username"], }); }
This is an example of the zod expansion, which is through the
extend
andrefine
functions of the zod’sZodRawShape
object. -
3:40pm -
Refactor
Refactor
The worst feeling about refactoring is knowning that you have to do it a couple times over and over. Even this current refactor that I am doing right now, sadly will be done again using SQLX instead of Diesel, which is a pain to think about down the line. The main reason we would be doing the refactor again, even if we are refactoring it right now is because of the C library that Diesel depends on for MySQL.
-
11:40pm -
Drizzle
Drizzle
When updating Drizzle within the monorepo, we run three commands. The first command, aka
./kbve.sh -atomic drizzle kit upgrade
, would be to create a new branch for the upgrade, just to make sure that nothing breaks! The second command ispnpm add drizzle-kit@latest -D
and finally the third command is./kbve.sh -reset
. Finally, let us test case the studio by running./kbve.sh -studio
.Inside of the studio, we want to add the seven global keys that we wiped earlier, which I placed under notes as keys.