-
Notifications
You must be signed in to change notification settings - Fork 6
/
extension.driver.php
77 lines (64 loc) · 1.47 KB
/
extension.driver.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
<?php
class extension_incremental_number extends Extension
{
/**
*
* Name of the extension field table
* @var string
*
* @since version 1.2.0
*/
const FIELD_TBL_NAME = 'tbl_fields_incremental_number';
/**
*
* install the extension
*
* @since version 1.0.0
*/
public function install()
{
return self::createFieldTable();
}
/**
*
* create the field table
*
* @since version 1.2.0
*/
public static function createFieldTable()
{
$tbl = self::FIELD_TBL_NAME;
return Symphony::Database()->query("
CREATE TABLE IF NOT EXISTS `$tbl` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`start_number` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
");
}
/**
*
* uninstall
*
* @since version 1.0.0
*/
public function uninstall()
{
return self::deleteFieldTable();
}
/**
*
* delete the field table
*
* @since version 1.2.0
*/
public static function deleteFieldTable()
{
$tbl = self::FIELD_TBL_NAME;
return Symphony::Database()->query("
DROP TABLE IF EXISTS `$tbl`
");
}
}