缴费
This commit is contained in:
+10
-3
@@ -140,7 +140,9 @@ export const sqliteSchema = `
|
||||
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
exam_id TEXT NOT NULL REFERENCES exams(id) ON DELETE CASCADE,
|
||||
status TEXT NOT NULL CHECK (status IN ('pending', 'approved', 'rejected')),
|
||||
payment_status TEXT NOT NULL CHECK (payment_status IN ('unpaid', 'paid', 'refunded')),
|
||||
payment_status TEXT NOT NULL CHECK (payment_status IN ('unpaid', 'paid')),
|
||||
paid_at TEXT,
|
||||
paid_by TEXT REFERENCES users(id) ON DELETE SET NULL,
|
||||
created_at TEXT NOT NULL,
|
||||
reviewed_at TEXT,
|
||||
review_note TEXT,
|
||||
@@ -409,6 +411,7 @@ export const sqliteSchema = `
|
||||
CREATE INDEX IF NOT EXISTS idx_exams_status_registration ON exams(status, registration_start, registration_end);
|
||||
CREATE INDEX IF NOT EXISTS idx_subjects_exam ON exam_subjects(exam_id, position);
|
||||
CREATE INDEX IF NOT EXISTS idx_registrations_status ON registrations(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_registrations_payment ON registrations(payment_status, paid_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_registrations_exam ON registrations(exam_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_arrangement_plans_exam ON exam_arrangement_plans(exam_id, generated_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_admit_subjects_room ON admit_card_subjects(subject_id, room_id, seat);
|
||||
@@ -621,7 +624,9 @@ export const mysqlSchema = [
|
||||
user_id VARCHAR(64) NOT NULL,
|
||||
exam_id VARCHAR(64) NOT NULL,
|
||||
status ENUM('pending', 'approved', 'rejected') NOT NULL,
|
||||
payment_status ENUM('unpaid', 'paid', 'refunded') NOT NULL,
|
||||
payment_status ENUM('unpaid', 'paid') NOT NULL,
|
||||
paid_at VARCHAR(35) NULL,
|
||||
paid_by VARCHAR(64) NULL,
|
||||
created_at VARCHAR(35) NOT NULL,
|
||||
reviewed_at VARCHAR(35) NULL,
|
||||
review_note VARCHAR(500) NULL,
|
||||
@@ -630,9 +635,11 @@ export const mysqlSchema = [
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uq_registrations_user_exam (user_id, exam_id),
|
||||
KEY idx_registrations_status (status),
|
||||
KEY idx_registrations_payment (payment_status, paid_at),
|
||||
KEY idx_registrations_exam (exam_id),
|
||||
CONSTRAINT fk_registrations_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_registrations_exam FOREIGN KEY (exam_id) REFERENCES exams(id) ON DELETE CASCADE
|
||||
CONSTRAINT fk_registrations_exam FOREIGN KEY (exam_id) REFERENCES exams(id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_registrations_paid_by FOREIGN KEY (paid_by) REFERENCES users(id) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci`,
|
||||
`CREATE TABLE IF NOT EXISTS registration_subjects (
|
||||
registration_id VARCHAR(64) NOT NULL,
|
||||
|
||||
Reference in New Issue
Block a user