| 1 |
<?php |
| 2 |
/** |
| 3 |
* Summary of Queue Meta Schema |
| 4 |
* Use this class to create database tables for Queue Meta feature. |
| 5 |
*/ |
| 6 |
class Queue_Meta_Schema |
| 7 |
{ |
| 8 |
/** |
| 9 |
* Summary of init |
| 10 |
* Initializes the database schema for external lists. |
| 11 |
* @return void |
| 12 |
*/ |
| 13 |
public static function init() |
| 14 |
{ |
| 15 |
// Initialization code if needed |
| 16 |
self::create_table(); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Summary of get_table_name |
| 21 |
* Get the name of the external list table. |
| 22 |
* @return string |
| 23 |
*/ |
| 24 |
public static function get_table_name() |
| 25 |
{ |
| 26 |
global $wpdb; |
| 27 |
return $wpdb->prefix . 'sue_queue_meta'; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Summary of create_table_external_list |
| 32 |
* Creates the database table for storing external list entries. |
| 33 |
* @return void |
| 34 |
*/ |
| 35 |
private static function create_table() |
| 36 |
{ |
| 37 |
global $wpdb; |
| 38 |
$table_name = self::get_table_name(); |
| 39 |
|
| 40 |
$charset_collate = $wpdb->get_charset_collate(); |
| 41 |
|
| 42 |
// Table for CSV rows |
| 43 |
$sql_rows = "CREATE TABLE $table_name ( |
| 44 |
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, |
| 45 |
sue_email_id BIGINT UNSIGNED NOT NULL, |
| 46 |
title VARCHAR(255) DEFAULT '', |
| 47 |
tagline VARCHAR(255) DEFAULT '', |
| 48 |
send_to_unsubscribed_users TINYINT(1) DEFAULT 0, |
| 49 |
created_at DATETIME NOT NULL, |
| 50 |
PRIMARY KEY (id), |
| 51 |
KEY sue_email_id (sue_email_id) |
| 52 |
) $charset_collate;"; |
| 53 |
|
| 54 |
dbDelta($sql_rows); |
| 55 |
} |
| 56 |
} |