Start work on custom fields

This commit is contained in:
2026-05-09 00:43:23 +02:00
parent 04d625110d
commit 8b54aff9ac
3 changed files with 53 additions and 2 deletions

View File

@@ -0,0 +1,51 @@
-- ========== Original Plugin Tables ==========
CREATE TABLE wp_go_form_forms (
id int NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
created_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE wp_go_form_entries (
id int NOT NULL AUTO_INCREMENT,
form_id int DEFAULT 1,
first_name varchar(100) NOT NULL,
last_name varchar(100) NOT NULL,
country varchar(100) DEFAULT NULL,
club varchar(100) DEFAULT NULL,
rank tinyint(2) DEFAULT 0,
rating smallint(5) DEFAULT 0,
egd_number varchar(20) DEFAULT NULL,
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (form_id) REFERENCES wp_go_form_forms(id) ON DELETE CASCADE,
INDEX (form_id)
);
-- ========== Custom Fields Tables ==========
CREATE TABLE wp_go_form_custom_fields (
id int NOT NULL AUTO_INCREMENT,
form_id int NOT NULL,
field_name varchar(100) NOT NULL,
field_type enum('select','text','checkbox', 'email') NOT NULL DEFAULT 'text',
field_options text,
is_public tinyint(1) NOT NULL DEFAULT 0,
is_required tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (id),
FOREIGN KEY (form_id) REFERENCES wp_go_form_forms(id) ON DELETE CASCADE,
INDEX (form_id)
);
CREATE TABLE wp_go_form_entry_custom_values (
id int NOT NULL AUTO_INCREMENT,
entry_id int NOT NULL,
field_id int NOT NULL,
value text,
PRIMARY KEY (id),
FOREIGN KEY (entry_id) REFERENCES wp_go_form_entries(id) ON DELETE CASCADE,
FOREIGN KEY (field_id) REFERENCES wp_go_form_custom_fields(id) ON DELETE CASCADE,
INDEX (entry_id),
INDEX (field_id)
);