forked from yakamara/redaxo_yrewrite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.php
73 lines (64 loc) · 2.35 KB
/
install.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
<?php
/**
* YREWRITE Addon.
*
* @author [email protected]
*
* @package redaxo\yrewrite
*
* @var rex_addon $this
*/
rex_sql_table::get(rex::getTable('article'))
->ensureColumn(new rex_sql_column('yrewrite_url', 'varchar(255)'))
->ensureColumn(new rex_sql_column('yrewrite_canonical_url', 'varchar(255)'))
->ensureColumn(new rex_sql_column('yrewrite_priority', 'varchar(5)'))
->ensureColumn(new rex_sql_column('yrewrite_changefreq', 'varchar(10)'))
->ensureColumn(new rex_sql_column('yrewrite_title', 'varchar(255)'))
->ensureColumn(new rex_sql_column('yrewrite_description', 'text'))
->ensureColumn(new rex_sql_column('yrewrite_index', 'tinyint(1)'))
->alter()
;
$sql = rex_sql::factory();
$sql->setQuery('CREATE TABLE IF NOT EXISTS `'.rex::getTable('yrewrite_domain').'` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`domain` varchar(255) NOT NULL,
`mount_id` int(11) NOT NULL,
`start_id` int(11) NOT NULL,
`notfound_id` int(11) NOT NULL,
`clangs` varchar(255) NOT NULL,
`clang_start` int(11) NOT NULL,
`clang_start_hidden` tinyint(1) NOT NULL,
`robots` TEXT NOT NULL,
`title_scheme` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
$sql->setQuery('CREATE TABLE IF NOT EXISTS `'.rex::getTable('yrewrite_alias').'` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`alias_domain` varchar(255) NOT NULL,
`domain_id` int(11) NOT NULL,
`clang_start` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
$sql->setQuery('CREATE TABLE IF NOT EXISTS `'.rex::getTable('yrewrite_forward').'` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`domain_id` int(11) NOT NULL,
`status` int(11) NOT NULL,
`url` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`article_id` int(11) NOT NULL,
`clang` int(11) NOT NULL,
`extern` varchar(255) NOT NULL,
`media` varchar(255) NOT NULL,
`movetype` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
rex_sql_table::get(rex::getTable('yrewrite_domain'))
->ensureColumn(new rex_sql_column('clang_start_hidden', 'tinyint(1)'))
->alter()
;
rex_sql_table::get(rex::getTable('yrewrite_forward'))
->ensureColumn(new rex_sql_column('domain_id', 'int(11)'))
->alter()
;
rex_delete_cache();