Skip to content

Commit

Permalink
Adds migration for proposed inflation adjustments of agreements
Browse files Browse the repository at this point in the history
  • Loading branch information
fellmirr committed Oct 30, 2024
1 parent 68d1bda commit d05ff3a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- CreateTable
CREATE TABLE `Agreement_inflation_adjustments` (
`ID` INTEGER NOT NULL AUTO_INCREMENT,
`agreement_ID` VARCHAR(45) NOT NULL,
`agreement_type` VARCHAR(20) NOT NULL,
`current_amount` INTEGER NOT NULL,
`proposed_amount` INTEGER NOT NULL,
`inflation_percentage` DECIMAL(10, 6) NOT NULL,
`token` VARCHAR(64) NOT NULL,
`status` VARCHAR(20) NOT NULL DEFAULT 'pending',
`created` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`updated` DATETIME(0) NULL,
`expires` DATETIME(0) NOT NULL,

UNIQUE INDEX `Agreement_inflation_adjustments_token_key`(`token`),
INDEX `Agreement_inflation_adjustments_agreement_ID_agreement_type_idx`(`agreement_ID`, `agreement_type`),
INDEX `Agreement_inflation_adjustments_status_idx`(`status`),
INDEX `Agreement_inflation_adjustments_expires_idx`(`expires`),
PRIMARY KEY (`ID`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
19 changes: 19 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,22 @@ model Conversion_rates {
PaymentMethod String @db.VarChar(45)
Rate Float
}

model Agreement_inflation_adjustments {
ID Int @id @default(autoincrement())
agreement_ID String @db.VarChar(45)
agreement_type String @db.VarChar(20) // "avtaleGiro", "autoGiro", "vipps"
current_amount Int // Stored in øre (cents)
proposed_amount Int // Stored in øre (cents)
inflation_percentage Decimal @db.Decimal(10, 6)
token String @unique @db.VarChar(64)
status String @default("pending") @db.VarChar(20) // "pending", "accepted", "rejected", "expired"
created DateTime @default(now()) @db.DateTime(0)
updated DateTime? @db.DateTime(0)
expires DateTime @db.DateTime(0)
@@index([agreement_ID, agreement_type])
@@index([status])
@@index([expires])
@@map("Agreement_inflation_adjustments")
}

0 comments on commit d05ff3a

Please sign in to comment.