PluginProbe
Independent Analytics – WordPress Analytics Plugin / 2.11.6
Independent Analytics – WordPress Analytics Plugin v2.11.6
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 All 120 releases
independent-analytics / IAWP / Migrations / Migration_31.php
Migration_31.php
39 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IAWP\Migrations;
4
5 use IAWP\Database;
6 use IAWP\Query;
7 /** @internal */
8 class Migration_31 extends \IAWP\Migrations\Step_Migration
9 {
10 /**
11 * @return int
12 */
13 protected function database_version() : int
14 {
15 return 31;
16 }
17 /**
18 * @return array
19 */
20 protected function queries() : array
21 {
22 return [$this->drop_table_if_exists(Query::get_table_name(Query::FORMS)), $this->drop_table_if_exists(Query::get_table_name(Query::FORM_SUBMISSIONS)), $this->create_forms_table(), $this->create_form_submissions_table()];
23 }
24 private function create_forms_table() : string
25 {
26 $forms_table = Query::get_table_name(Query::FORMS);
27 $character_set = Database::character_set();
28 $collation = Database::collation();
29 return "\n CREATE TABLE IF NOT EXISTS {$forms_table} (\n form_id BIGINT(20) UNSIGNED AUTO_INCREMENT,\n plugin_id BIGINT(20) UNSIGNED NOT NULL,\n plugin_form_id BIGINT(20) UNSIGNED NOT NULL,\n cached_form_title VARCHAR(64) NOT NULL,\n PRIMARY KEY (form_id),\n UNIQUE INDEX (plugin_id, plugin_form_id)\n ) DEFAULT CHARACTER SET {$character_set} COLLATE {$collation};\n ";
30 }
31 private function create_form_submissions_table() : string
32 {
33 $form_submissions_table = Query::get_table_name(Query::FORM_SUBMISSIONS);
34 $character_set = Database::character_set();
35 $collation = Database::collation();
36 return "\n CREATE TABLE IF NOT EXISTS {$form_submissions_table} (\n form_submission_id BIGINT(20) UNSIGNED AUTO_INCREMENT,\n form_id BIGINT(20) UNSIGNED NOT NULL,\n session_id BIGINT(20) UNSIGNED NOT NULL,\n view_id BIGINT(20) UNSIGNED NOT NULL,\n initial_view_id BIGINT(20) UNSIGNED NOT NULL,\n created_at DATETIME NOT NULL,\n PRIMARY KEY (form_submission_id)\n ) DEFAULT CHARACTER SET {$character_set} COLLATE {$collation};\n ";
37 }
38 }
39