This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
schema.php
99 lines (94 loc) · 3.36 KB
/
schema.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* Plugin database schema
* WARNING:
* dbDelta() doesn't like empty lines in schema string, so don't put them there;
* WPDB doesn't like NULL values so better not to have them in the tables;
*/
/**
* The database character collate.
* @var string
* @global string
* @name $charset_collate
*/
$charset_collate = '';
// Declare these as global in case schema.php is included from a function.
global $wpdb, $plugin_queries;
if ( ! empty($wpdb->charset))
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate))
$charset_collate .= " COLLATE $wpdb->collate";
$table_prefix = PMXI_Plugin::getInstance()->getTablePrefix();
$plugin_queries = <<<SCHEMA
CREATE TABLE {$table_prefix}templates (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
options LONGTEXT,
scheduled VARCHAR(64) NOT NULL DEFAULT '',
name VARCHAR(200) NOT NULL DEFAULT '',
title TEXT,
content LONGTEXT,
is_keep_linebreaks TINYINT(1) NOT NULL DEFAULT 0,
is_leave_html TINYINT(1) NOT NULL DEFAULT 0,
fix_characters TINYINT(1) NOT NULL DEFAULT 0,
meta LONGTEXT,
PRIMARY KEY (id)
) $charset_collate;
CREATE TABLE {$table_prefix}imports (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
parent_import_id BIGINT(20) NOT NULL DEFAULT 0,
name VARCHAR(255) NOT NULL DEFAULT '',
friendly_name VARCHAR(255) NOT NULL DEFAULT '',
type VARCHAR(32) NOT NULL DEFAULT '',
feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '',
path TEXT,
xpath TEXT,
options LONGTEXT,
registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
root_element VARCHAR(255) DEFAULT '',
processing BOOL NOT NULL DEFAULT 0,
executing BOOL NOT NULL DEFAULT 0,
triggered BOOL NOT NULL DEFAULT 0,
queue_chunk_number BIGINT(20) NOT NULL DEFAULT 0,
first_import TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
count BIGINT(20) NOT NULL DEFAULT 0,
imported BIGINT(20) NOT NULL DEFAULT 0,
created BIGINT(20) NOT NULL DEFAULT 0,
updated BIGINT(20) NOT NULL DEFAULT 0,
skipped BIGINT(20) NOT NULL DEFAULT 0,
deleted BIGINT(20) NOT NULL DEFAULT 0,
canceled BOOL NOT NULL DEFAULT 0,
canceled_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
failed BOOL NOT NULL DEFAULT 0,
failed_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
settings_update_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
last_activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
iteration BIGINT(20) NOT NULL DEFAULT 0,
PRIMARY KEY (id)
) $charset_collate;
CREATE TABLE {$table_prefix}posts (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
post_id BIGINT(20) UNSIGNED NOT NULL,
import_id BIGINT(20) UNSIGNED NOT NULL,
unique_key TEXT,
product_key TEXT,
iteration BIGINT(20) NOT NULL DEFAULT 0,
PRIMARY KEY (id)
) $charset_collate;
CREATE TABLE {$table_prefix}files (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
import_id BIGINT(20) UNSIGNED NOT NULL,
name VARCHAR(255) NOT NULL DEFAULT '',
path TEXT,
registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) $charset_collate;
CREATE TABLE {$table_prefix}history (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
import_id BIGINT(20) UNSIGNED NOT NULL,
type ENUM('manual','processing','trigger','continue','') NOT NULL DEFAULT '',
time_run TEXT,
date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
summary TEXT,
PRIMARY KEY (id)
) $charset_collate;
SCHEMA;