mirror of
https://github.com/Alvin-Zilverstand/Spik-en-span.git
synced 2026-03-06 11:17:09 +01:00
Refactor project structure: remove old files and reorganize ticket ordering system
- Deleted obsolete CSS files (bestellen.css, style.css) and JavaScript (script.js). - Removed old HTML files for ticket ordering (vrijdag-kinderen.html, vrijdag-volwassenen.html, zaterdag-kinderen.html, zaterdag-volwassenen.html). - Created new HTML files for ticket ordering under 'order-pages' directory. - Updated ticket links in 'bestellen.html' to point to new order pages. - Recreated database schema in a new file under 'db stuff' directory.
This commit is contained in:
56
db stuff/database.sql
Normal file
56
db stuff/database.sql
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS spik_en_span;
|
||||
USE spik_en_span;
|
||||
|
||||
|
||||
CREATE TABLE tickets (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
ticket_id VARCHAR(255) NOT NULL UNIQUE,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL,
|
||||
category ENUM('adult', 'child', 'group') NOT NULL,
|
||||
quantity INT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE employees (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
username VARCHAR(255) NOT NULL UNIQUE,
|
||||
password_hash VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE scanned_tickets (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
ticket_id VARCHAR(255) NOT NULL,
|
||||
scanned_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
is_valid BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
UNIQUE (ticket_id)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE unique_strings (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT NOT NULL,
|
||||
unique_code CHAR(6) NOT NULL UNIQUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES employees(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER generate_unique_code
|
||||
AFTER INSERT ON employees
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE unique_code CHAR(6);
|
||||
SET unique_code = (SELECT SUBSTRING(CONCAT(MD5(RAND()), MD5(RAND())), 1, 6));
|
||||
INSERT INTO unique_strings (user_id, unique_code) VALUES (NEW.id, unique_code);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
INSERT INTO employees (username, password_hash)
|
||||
VALUES ('admin', SHA2('password', 256));
|
||||
Reference in New Issue
Block a user