Modified database update on plugin activation
This commit is contained in:
parent
b4799adf51
commit
871e0f4988
1 changed files with 5 additions and 5 deletions
|
|
@ -81,22 +81,22 @@ function activate_quiztech() {
|
||||||
$charset_collate = $wpdb->get_charset_collate();
|
$charset_collate = $wpdb->get_charset_collate();
|
||||||
$table_name = $wpdb->prefix . 'quiztech_invitations';
|
$table_name = $wpdb->prefix . 'quiztech_invitations';
|
||||||
|
|
||||||
$sql = "CREATE TABLE $table_name (
|
$sql = "CREATE TABLE {$table_name} (
|
||||||
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
||||||
token varchar(32) NOT NULL,
|
token varchar(32) NOT NULL,
|
||||||
job_id bigint(20) unsigned NOT NULL,
|
job_id bigint(20) unsigned NOT NULL,
|
||||||
assessment_id bigint(20) unsigned NOT NULL,
|
assessment_id bigint(20) unsigned NOT NULL,
|
||||||
applicant_email varchar(255) NOT NULL,
|
applicant_email varchar(255) NOT NULL,
|
||||||
status varchar(20) NOT NULL DEFAULT 'pending', -- e.g., pending, viewed, completed, expired
|
status varchar(20) NOT NULL DEFAULT 'pending',
|
||||||
created_timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
|
created_timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
|
||||||
expiry_timestamp datetime DEFAULT NULL, -- Optional expiry
|
expiry_timestamp datetime DEFAULT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY token (token),
|
UNIQUE KEY token (token),
|
||||||
KEY job_id (job_id),
|
KEY job_id (job_id),
|
||||||
KEY assessment_id (assessment_id),
|
KEY assessment_id (assessment_id),
|
||||||
KEY applicant_email (applicant_email(191)), -- Index prefix for potential long emails
|
KEY applicant_email (applicant_email(191)),
|
||||||
KEY status (status)
|
KEY status (status)
|
||||||
) $charset_collate;";
|
) {$charset_collate};";
|
||||||
|
|
||||||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
||||||
\dbDelta( $sql );
|
\dbDelta( $sql );
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue