| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Current tables migration version |
| 20 | 20 | */ |
| 21 | - const MIGRATION_VERSION = "0.4.9"; | |
| 21 | + const MIGRATION_VERSION = "0.2.0"; | |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Prefix for version option name |
| 25 | 25 | */ |
| @@ -32,9 +32,9 @@ | ||
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Table names |
| 35 | 35 | */ |
| 36 | - protected $table_names = [ 'documents', 'options', 'meta', 'leads', 'lead_fields', 'queue_jobs', 'document_analytics' ]; | |
| 36 | + protected $table_names = [ 'documents', 'options' ]; | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Create documents table |
| @@ -85,113 +85,7 @@ | ||
| 85 | 85 | |
| 86 | 86 | $this->dbDelta( $sql_create_table ); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - /** | |
| 90 | - * Create meta table | |
| 91 | - * | |
| 92 | - * @since 1.0 | |
| 93 | - * @return null | |
| 94 | - */ | |
| 95 | - public function create_table_meta() { | |
| 89 | +} | |
| 96 | 90 | |
| 97 | - $sql_create_table = "CREATE TABLE {$this->meta} ( | |
| 98 | - id bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
| 99 | - relation varchar(30) NOT NULL DEFAULT '', | |
| 100 | - relation_id bigint(20) NOT NULL, | |
| 101 | - meta_key varchar(30) NOT NULL DEFAULT '', | |
| 102 | - meta_value text NOT NULL DEFAULT '', | |
| 103 | - PRIMARY KEY (id) | |
| 104 | - ) {$this->charset_collate()};\n"; | |
| 105 | 91 | |
| 106 | - $this->dbDelta( $sql_create_table ); | |
| 107 | - } | |
| 108 | - | |
| 109 | - /** | |
| 110 | - * Create meta table | |
| 111 | - * | |
| 112 | - * @since 1.0 | |
| 113 | - * @return null | |
| 114 | - */ | |
| 115 | - public function create_table_leads() { | |
| 116 | - | |
| 117 | - $sql_create_table = "CREATE TABLE {$this->leads} ( | |
| 118 | - id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
| 119 | - source_id bigint(20) unsigned NOT NULL, | |
| 120 | - content_id bigint(20) NOT NULL, | |
| 121 | - content_name varchar(150) NOT NULL, | |
| 122 | - created_at datetime DEFAULT NULL | |
| 123 | - ) {$this->charset_collate()};\n"; | |
| 124 | - | |
| 125 | - $this->dbDelta( $sql_create_table ); | |
| 126 | - } | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * Create meta table | |
| 130 | - * | |
| 131 | - * @since 1.0 | |
| 132 | - * @return null | |
| 133 | - */ | |
| 134 | - public function create_table_lead_fields() { | |
| 135 | - | |
| 136 | - $sql_create_table = "CREATE TABLE {$this->lead_fields} ( | |
| 137 | - id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
| 138 | - lead_id bigint(20) unsigned NOT NULL, | |
| 139 | - name varchar(255) NOT NULL, | |
| 140 | - type varchar(50) NOT NULL DEFAULT '', | |
| 141 | - value text NOT NULL DEFAULT '', | |
| 142 | - created_at datetime DEFAULT NULL, | |
| 143 | - updated_at datetime DEFAULT NULL | |
| 144 | - ) {$this->charset_collate()};\n"; | |
| 145 | - | |
| 146 | - $this->dbDelta( $sql_create_table ); | |
| 147 | - } | |
| 148 | - | |
| 149 | - public function create_table_queue_jobs() { | |
| 150 | - | |
| 151 | - $sql_create_table = "CREATE TABLE {$this->queue_jobs} ( | |
| 152 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 153 | - queue VARCHAR(50) NOT NULL DEFAULT 'default', | |
| 154 | - payload LONGTEXT NOT NULL, | |
| 155 | - attempts TINYINT UNSIGNED NOT NULL DEFAULT 0, | |
| 156 | - reserved_at DATETIME DEFAULT NULL, | |
| 157 | - available_at DATETIME NOT NULL, | |
| 158 | - created_at DATETIME NOT NULL, | |
| 159 | - status VARCHAR(20) NOT NULL DEFAULT 'pending', -- pending, processing, failed, completed | |
| 160 | - last_error TEXT DEFAULT NULL, | |
| 161 | - PRIMARY KEY (id), | |
| 162 | - KEY status (status), | |
| 163 | - KEY available_at (available_at), | |
| 164 | - KEY queue (queue) | |
| 165 | - ) {$this->charset_collate()};\n"; | |
| 166 | - | |
| 167 | - $this->dbDelta($sql_create_table); | |
| 168 | - } | |
| 169 | - | |
| 170 | - /** | |
| 171 | - * Create document_analytics_events table for tracking document impressions/submissions | |
| 172 | - * | |
| 173 | - * @since 1.0 | |
| 174 | - * @return null | |
| 175 | - */ | |
| 176 | - public function create_table_document_analytics() { | |
| 177 | - | |
| 178 | - $sql_create_table = "CREATE TABLE {$this->document_analytics} ( | |
| 179 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 180 | - source_id BIGINT(20) UNSIGNED NOT NULL, | |
| 181 | - event_type VARCHAR(20) NOT NULL, | |
| 182 | - session_id CHAR(32) NOT NULL, | |
| 183 | - user_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, | |
| 184 | - ip_address VARBINARY(16) NOT NULL, | |
| 185 | - created_at DATETIME NOT NULL, | |
| 186 | - PRIMARY KEY (id), | |
| 187 | - KEY idx_document_analytics_performance (source_id, event_type, created_at), | |
| 188 | - KEY idx_document_analytics_session (session_id, created_at), | |
| 189 | - CONSTRAINT fk_document_analytics_source | |
| 190 | - FOREIGN KEY (source_id) | |
| 191 | - REFERENCES {$this->documents} (id) | |
| 192 | - ON DELETE CASCADE | |
| 193 | - ) {$this->charset_collate()};\n"; | |
| 194 | - | |
| 195 | - $this->dbDelta($sql_create_table); | |
| 196 | - } | |
| 197 | -} | |