-
Notifications
You must be signed in to change notification settings - Fork 40
Lagersystem för sexet #1032
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
base: main
Are you sure you want to change the base?
Lagersystem för sexet #1032
Changes from all commits
2a5be79
f2ee779
05f0499
ca5058c
2e829d9
057c773
8fdabf9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| -- CreateEnum | ||
| CREATE TYPE "DrinkQuantityType" AS ENUM ('NONE', 'WEIGHT', 'COUNTS'); | ||
|
|
||
| -- CreateEnum | ||
| CREATE TYPE "DrinkGroup" AS ENUM ('S1', 'S2', 'S3', 'S4'); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "drinkitem" ( | ||
| "id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
| "quantity_type" "DrinkQuantityType" NOT NULL, | ||
| "name" TEXT NOT NULL, | ||
| "price" INTEGER NOT NULL, | ||
| "group" "DrinkGroup" NOT NULL, | ||
| "systembolaget_id" INTEGER NOT NULL, | ||
|
|
||
| CONSTRAINT "drinkitem_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "drinkitembatch" ( | ||
| "id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
| "drink_item_id" UUID NOT NULL, | ||
| "best_before_date" TIMESTAMP(3) NOT NULL, | ||
| "quantity" INTEGER NOT NULL, | ||
|
|
||
| CONSTRAINT "drinkitembatch_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "drinkitembatch" ADD CONSTRAINT "drinkitembatch_drink_item_id_fkey" FOREIGN KEY ("drink_item_id") REFERENCES "drinkitem"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /* | ||
| Warnings: | ||
|
|
||
| - You are about to drop the column `best_before_date` on the `drinkitembatch` table. All the data in the column will be lost. | ||
|
|
||
| */ | ||
| -- AlterTable | ||
| ALTER TABLE "drinkitembatch" DROP COLUMN "best_before_date"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "drinkitem" ADD COLUMN "bottle_empty_weight" INTEGER, | ||
| ADD COLUMN "bottle_full_weight" INTEGER; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| -- CreateTable | ||
| CREATE TABLE "sexetinventoryvaluelog" ( | ||
| "id" UUID NOT NULL DEFAULT gen_random_uuid(), | ||
| "date" TIMESTAMP(3) NOT NULL, | ||
| "value" INTEGER NOT NULL, | ||
|
|
||
| CONSTRAINT "sexetinventoryvaluelog_pkey" PRIMARY KEY ("id") | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* | ||
| Warnings: | ||
|
|
||
| - Added the required column `date` to the `drinkitembatch` table without a default value. This is not possible if the table is not empty. | ||
| - Added the required column `user` to the `drinkitembatch` table without a default value. This is not possible if the table is not empty. | ||
|
|
||
| */ | ||
| -- AlterTable | ||
| ALTER TABLE "drinkitembatch" ADD COLUMN "date" TIMESTAMP(3) NOT NULL, | ||
| ADD COLUMN "user" TEXT NOT NULL; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* | ||
| Warnings: | ||
|
|
||
| - You are about to drop the column `quantity` on the `drinkitembatch` table. All the data in the column will be lost. | ||
|
|
||
| */ | ||
| -- AlterTable | ||
| ALTER TABLE "drinkitembatch" DROP COLUMN "quantity", | ||
| ADD COLUMN "quantityIn" INTEGER, | ||
| ADD COLUMN "quantityOut" INTEGER; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- AlterTable | ||
| ALTER TABLE "drinkitembatch" ADD COLUMN "nrBottles" INTEGER; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,6 +539,68 @@ model Markdown { | |
| @@map("markdowns") | ||
| } | ||
|
|
||
|
|
||
| model DrinkItem { | ||
| id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid | ||
| quantityType DrinkQuantityType @map("quantity_type") | ||
| name String | ||
| price Int | ||
| group DrinkGroup | ||
| systembolagetID Int @map("systembolaget_id") | ||
| bottleEmptyWeight Int? @map("bottle_empty_weight") | ||
| bottleFullWeight Int? @map("bottle_full_weight") | ||
|
|
||
| stockLists DrinkItemBatch[] | ||
|
|
||
| @@allow("read", true) | ||
| @@allow("create", has(auth().policies, "drinkitem:create")) | ||
| @@allow("update", has(auth().policies, "drinkitem:update")) | ||
| @@allow("delete", has(auth().policies, "drinkitem:delete")) | ||
| @@map("drinkitem") | ||
| } | ||
|
|
||
| model DrinkItemBatch { | ||
| id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid | ||
| drinkItemId String @map("drink_item_id") @db.Uuid | ||
| item DrinkItem @relation(fields: [drinkItemId], references: [id]) | ||
| quantityIn Int? | ||
| quantityOut Int? | ||
|
Comment on lines
+566
to
+567
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Är det meningen att dessa ska vara nullable? Defaulta till 0 istället? |
||
| user String | ||
| date DateTime | ||
| nrBottles Int? | ||
|
|
||
| @@allow("read", true) | ||
| @@allow("create", has(auth().policies, "drinkitembatch:create")) | ||
| @@allow("update", has(auth().policies, "drinkitembatch:update")) | ||
| @@allow("delete", has(auth().policies, "drinkitembatch:delete")) | ||
| @@map("drinkitembatch") | ||
| } | ||
|
|
||
| model SexetInventoryValueLog { | ||
| id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid | ||
| date DateTime | ||
| value Int | ||
|
|
||
| @@allow("read", true) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. För alla databas-models ni har skapat: är det meningen att vem som helst ska kunna se allt? |
||
| @@allow("create", has(auth().policies, "drinkitembatch:create")) | ||
| @@allow("update", has(auth().policies, "drinkitembatch:update")) | ||
| @@allow("delete", has(auth().policies, "drinkitembatch:delete")) | ||
| @@map("sexetinventoryvaluelog") | ||
| } | ||
|
|
||
| enum DrinkQuantityType { | ||
| NONE | ||
| WEIGHT | ||
| COUNTS | ||
| } | ||
|
|
||
| enum DrinkGroup { | ||
| S1 | ||
| S2 | ||
| S3 | ||
| S4 | ||
| } | ||
|
|
||
| model Meeting { | ||
| id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid | ||
| title String @db.VarChar(255) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ni borde squasha era migrations. Det kan ni göra genom att ta bort alla migrations ni har skapat och sedan köra pnpm migrate, så kommer en enda stor migration skapas