edited scheme but still not working

This commit is contained in:
2025-11-24 16:05:56 +01:00
parent cb6b5858e5
commit d64489aed4
3 changed files with 32 additions and 4 deletions

View File

@@ -37,14 +37,12 @@ CREATE TABLE items (
item_name varchar(255) NOT NULL UNIQUE,
can_borrow_role INT NOT NULL,
in_safe bool NOT NULL DEFAULT true,
safe_nr CHAR(2) DEFAULT NULL,
safe_nr INT DEFAULT NULL UNIQUE,
entry_created_at timestamp NULL DEFAULT CURRENT_TIMESTAMP,
entry_updated_at timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
last_borrowed_person varchar(255) DEFAULT NULL,
currently_borrowing varchar(255) DEFAULT NULL,
PRIMARY KEY (id),
CHECK (safe_nr REGEXP '^[0-9]{2}$' OR safe_nr IS NULL),
UNIQUE KEY ux_items_safe_nr (safe_nr)
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE apiKeys (
@@ -55,4 +53,11 @@ CREATE TABLE apiKeys (
entry_created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
CHECK (api_key REGEXP '^[0-9]{8}$')
) ENGINE=InnoDB;
CREATE TABLE doorKeys (
id int NOT NULL AUTO_INCREMENT,
door_key INT NOT NULL,
lockers INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;