Switch DB crate

This commit is contained in:
Bianca Fürstenau 2025-03-11 08:00:11 +01:00
parent 61105ccf37
commit 58206d41b5
9 changed files with 126 additions and 57 deletions

29
migrations/0000_init.sql Normal file
View file

@ -0,0 +1,29 @@
CREATE TABLE `swap` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`acc` INTEGER NOT NULL,
`voucher` INTEGER NOT NULL,
`storno` INTEGER NOT NULL,
`timestamp` INTEGER NOT NULL
);
CREATE TABLE `voucher_type` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`store` INTEGER NOT NULL,
`value` INTEGER NOT NULL,
UNIQUE (`store`, `value`)
);
CREATE TABLE `inventory` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`acc` INTEGER NOT NULL,
`cash` INTEGER NOT NULL,
`timestamp` INTEGER NOT NULL,
UNIQUE (`acc`, `timestamp`)
);
CREATE TABLE `voucher_inventory` (
`inventory` INTEGER NOT NULL,
`voucher` INTEGER NOT NULL,
`count` INTEGER NOT NULL,
PRIMARY KEY (`inventory`, `voucher`)
);