PluginProbe
Lasso Lite – Affiliate Link Manager & Product Displays / 114
Lasso Lite – Affiliate Link Manager & Product Displays v114
158 157 155 156 154 153 152 151 150 149 148 trunk 0.9.9 104 105 106 107 108 109 110 111 112 113 114 115 All 57 releases
simple-urls / models / class-revert.php

class-revert.php in Lasso Lite – Affiliate Link Manager & Product Displays 114, at models/class-revert.php

76 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Models
4 *
5 * @package Models
6 */
7
8 namespace LassoLite\Models;
9
10 /**
11 * Model
12 */
13 class Revert extends Model {
14 /**
15 * Table name
16 *
17 * @var string
18 */
19 protected $table = 'lasso_lite_revert';
20
21 /**
22 * Columns of the table
23 *
24 * @var array
25 */
26 protected $columns = array(
27 'id',
28 'lasso_id',
29 'post_data',
30 'old_uri',
31 'plugin',
32
33 'revert_dt',
34 );
35
36 /**
37 * Primary key of the table
38 *
39 * @var string
40 */
41 protected $primary_key = 'id';
42
43 /**
44 * Create table
45 */
46 public function create_table() {
47 $columns_sql = '
48 id bigint(10) NOT NULL AUTO_INCREMENT,
49 lasso_id bigint(20) NOT NULL,
50 post_data text NULL,
51 old_uri varchar(500) NOT NULL,
52 plugin varchar(200) NOT NULL,
53 revert_dt datetime NOT NULL,
54 PRIMARY KEY (id)
55 ';
56 $sql = '
57 CREATE TABLE ' . $this->get_table_name() . ' (
58 ' . $columns_sql . '
59 ) ' . $this->get_charset_collate();
60
61 return $this->modify_table( $sql, $this->get_table_name() );
62 }
63
64 /**
65 * Update DB structure and data for v228
66 */
67 public function update_for_v228() {
68 // ? change datetime column to not null
69 $query = '
70 ALTER TABLE ' . $this->get_table_name() . '
71 CHANGE `revert_dt` `revert_dt` DATETIME NOT NULL
72 ';
73 self::query( $query );
74 }
75 }
76