PluginProbe
Depicter — Popup & Slider Builder / 1.3.3
Depicter — Popup & Slider Builder v1.3.3
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Database / Migration.php

Migration.php in Depicter — Popup & Slider Builder 1.3.3, at app/src/Database/Migration.php

92 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Database;
3
4 use Averta\WordPress\Database\Migration as BaseMigration;
5
6 // no direct access allowed
7 if ( ! defined('ABSPATH') ) {
8 die();
9 }
10
11 /**
12 * Migration for custom tables
13 *
14 * @package Depicter\Database
15 */
16 class Migration extends BaseMigration {
17
18 /**
19 * Current tables migration version
20 */
21 const MIGRATION_VERSION = "0.2.0";
22
23 /**
24 * Prefix for version option name
25 */
26 const VERSION_PREFIX = "depicter_";
27
28 /**
29 * Table prefix
30 */
31 const TABLE_PREFIX = 'depicter_';
32
33 /**
34 * Table names
35 */
36 protected $table_names = [ 'documents', 'options' ];
37
38
39 /**
40 * Create documents table
41 *
42 * @since 1.0
43 * @return null
44 */
45 protected function create_table_documents() {
46
47 $sql_create_table = "CREATE TABLE {$this->documents} (
48 id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
49 name text NOT NULL,
50 slug varchar(100) NOT NULL,
51 type varchar(50) NOT NULL DEFAULT 'custom',
52 author bigint(20) unsigned NOT NULL DEFAULT '0',
53 sections_count mediumint NOT NULL DEFAULT '0',
54 created_at datetime DEFAULT NULL,
55 modified_at datetime DEFAULT NULL,
56 thumbnail varchar(255) NOT NULL,
57 content longtext NOT NULL,
58 status varchar(20) NOT NULL DEFAULT 'draft',
59 parent bigint(20) unsigned NOT NULL DEFAULT '0',
60 password varchar(255) NOT NULL DEFAULT '',
61 PRIMARY KEY (id),
62 KEY created_at (created_at),
63 KEY slug (slug)
64 ) {$this->charset_collate()};\n";
65
66 $this->dbDelta( $sql_create_table );
67 }
68
69
70 /**
71 * Create options table
72 *
73 * @since 1.0
74 * @return null
75 */
76 public function create_table_options() {
77
78 $sql_create_table = "CREATE TABLE {$this->options} (
79 id mediumint unsigned NOT NULL AUTO_INCREMENT,
80 option_name varchar(191) NOT NULL DEFAULT '',
81 option_value text NOT NULL DEFAULT '',
82 PRIMARY KEY (id),
83 UNIQUE KEY option_name (option_name)
84 ) {$this->charset_collate()};\n";
85
86 $this->dbDelta( $sql_create_table );
87 }
88
89 }
90
91
92