generated from jric11/baseProject
ChatGPT's update to harden software and run db updates.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
CREATE TABLE IF NOT EXISTS club_invitations (
|
||||
invitation_serial BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
club_serial BIGINT UNSIGNED NOT NULL,
|
||||
invite_email VARCHAR(100) NOT NULL,
|
||||
membership_role ENUM('member','administrator') NOT NULL DEFAULT 'member',
|
||||
invited_by BIGINT UNSIGNED NOT NULL,
|
||||
invitation_status ENUM('pending','accepted','revoked') NOT NULL DEFAULT 'pending',
|
||||
expires_at DATETIME NOT NULL,
|
||||
sent_at DATETIME NOT NULL,
|
||||
accepted_at DATETIME NULL,
|
||||
UNIQUE KEY (club_serial,invite_email),
|
||||
FOREIGN KEY (club_serial) REFERENCES clubs(club_serial) ON DELETE RESTRICT,
|
||||
FOREIGN KEY (invited_by) REFERENCES users(user_serial) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
CREATE TABLE IF NOT EXISTS club_tickets (
|
||||
ticket_serial BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
club_serial BIGINT UNSIGNED NOT NULL,
|
||||
user_serial BIGINT UNSIGNED NOT NULL,
|
||||
subject VARCHAR(200) NOT NULL,
|
||||
ticket_status ENUM('open','closed') NOT NULL DEFAULT 'open',
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
INDEX (club_serial,user_serial,ticket_serial),
|
||||
FOREIGN KEY (club_serial) REFERENCES clubs(club_serial) ON DELETE RESTRICT,
|
||||
FOREIGN KEY (user_serial) REFERENCES users(user_serial) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
CREATE TABLE IF NOT EXISTS club_ticket_messages (
|
||||
message_serial BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
ticket_serial BIGINT UNSIGNED NOT NULL,
|
||||
author_serial BIGINT UNSIGNED NOT NULL,
|
||||
message_text TEXT NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (ticket_serial) REFERENCES club_tickets(ticket_serial) ON DELETE RESTRICT,
|
||||
FOREIGN KEY (author_serial) REFERENCES users(user_serial) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
Reference in New Issue
Block a user