Rev 196 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 196 | Rev 198 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | class SeriesTable extends \PointedEars\PHPX\Db\MySQLTable |
3 | class SeriesTable extends \PointedEars\PHPX\Db\MySQLTable |
4 | {
|
4 | {
|
5 | /**
|
5 | /**
|
6 | * (non-PHPdoc)
|
6 | * (non-PHPdoc)
|
7 | * @see \PointedEars\PHPX\Db\Table::$_name
|
7 | * @see \PointedEars\PHPX\Db\Table::$_name
|
8 | */
|
8 | */
|
9 | protected static $_name = 'series'; |
9 | protected static $_name = 'series'; |
10 | 10 | ||
11 | /**
|
11 | /**
|
12 | * (non-PHPdoc)
|
12 | * (non-PHPdoc)
|
13 | * @see \PointedEars\PHPX\Db\Table::$_columns
|
13 | * @see \PointedEars\PHPX\Db\Table::$_columns
|
14 | */
|
14 | */
|
15 | protected static $_columns = array( |
15 | protected static $_columns = array( |
16 | /* UNSIGNED INT NOT NULL AUTO_INCREMENT */
|
16 | /* UNSIGNED INT NOT NULL AUTO_INCREMENT */
|
17 | 'series_id' => array( |
17 | 'series_id' => array( |
18 | 'type' => 'INT', |
18 | 'type' => 'INT', |
19 | 'unsigned' => true, |
19 | 'unsigned' => true, |
20 | 'not_null' => true, |
20 | 'not_null' => true, |
21 | 'auto_inc' => true |
21 | 'auto_inc' => true |
22 | ), |
22 | ), |
23 | 23 | ||
24 | /* VARCHAR(45) NOT NULL */
|
24 | /* VARCHAR(45) NOT NULL */
|
25 | 'title' => array( |
25 | 'title' => array( |
26 | 'type' => 'VARCHAR(45)', |
26 | 'type' => 'VARCHAR(45)', |
27 | 'not_null' => true |
27 | 'not_null' => true |
28 | ), |
28 | ), |
29 | 29 | ||
30 | /* BIT NOT NULL DEFAULT 0 */
|
30 | /* BIT NOT NULL DEFAULT 0 */
|
31 | 'ignore' => array( |
31 | 'ignore' => array( |
32 | 'type' => 'BIT', |
32 | 'type' => 'BIT', |
33 | 'not_null' => true, |
33 | 'not_null' => true, |
34 | 'default' => 0 |
34 | 'default' => 0 |
35 | ), |
35 | ), |
36 | 36 | ||
37 | /* INT UNSIGNED NOT NULL */
|
37 | /* INT UNSIGNED NOT NULL */
|
38 | 'channel_id' => array( |
38 | 'channel_id' => array( |
39 | 'type' => 'INT', |
39 | 'type' => 'INT', |
40 | 'unsigned' => true, |
40 | 'unsigned' => true, |
41 | 'not_null' => true |
41 | 'not_null' => true |
42 | ), |
42 | ), |
43 | 43 | ||
44 | /* DATETIME NULL */
|
44 | /* DATETIME NULL */
|
45 | 'last_seen' => array( |
45 | 'last_seen' => array( |
46 | 'type' => 'DATETIME', |
46 | 'type' => 'DATETIME', |
47 | ), |
47 | ), |
48 | 48 | ||
49 | /* VARCHAR(45) NULL */
|
49 | /* VARCHAR(45) NULL */
|
50 | 'seasons' => array( |
50 | 'seasons' => array( |
51 | 'type' => 'VARCHAR(45)', |
51 | 'type' => 'VARCHAR(45)', |
52 | ), |
52 | ), |
53 | 53 | ||
54 | /* VARCHAR(45) NULL */
|
54 | /* VARCHAR(45) NULL */
|
55 | 'url' => array( |
55 | 'url' => array( |
56 | 'type' => 'VARCHAR(45)', |
56 | 'type' => 'VARCHAR(45)', |
57 | )
|
57 | )
|
58 | ); |
58 | ); |
59 | 59 | ||
60 | /**
|
60 | /**
|
61 | * (non-PHPdoc)
|
61 | * (non-PHPdoc)
|
62 | * @see \PointedEars\PHPX\Db\Table::$_indexes
|
62 | * @see \PointedEars\PHPX\Db\Table::$_indexes
|
63 | */
|
63 | */
|
64 | protected static $_indexes = array( |
64 | protected static $_indexes = array( |
65 | /* UNIQUE INDEX `title_UNIQUE` (`title` ASC) */
|
65 | /* UNIQUE INDEX `title_UNIQUE` (`title` ASC) */
|
66 | 'title_UNIQUE' => array( |
66 | 'title_UNIQUE' => array( |
67 | 'unique' => true, |
67 | 'unique' => true, |
68 | 'columns' => array('title' => 'ASC') |
68 | 'columns' => array('title' => 'ASC') |
69 | ), |
69 | ), |
70 | 70 | ||
71 | /* PRIMARY KEY (`series_id`) */
|
71 | /* PRIMARY KEY (`series_id`) */
|
72 | 'PRIMARY' => array( |
72 | 'PRIMARY' => array( |
73 | 'columns' => array('series_id') |
73 | 'columns' => array('series_id') |
74 | ), |
74 | ), |
75 | 75 | ||
76 | /* INDEX `fk_series_channel` (`channel_id` ASC) */
|
76 | /* INDEX `fk_series_channel` (`channel_id` ASC) */
|
77 | 'fk_series_channel' => array( |
77 | 'fk_series_channel' => array( |
78 | 'columns' => array('channel_id' => 'ASC') |
78 | 'columns' => array('channel_id' => 'ASC') |
79 | )
|
79 | )
|
80 | ); |
80 | ); |
81 | 81 | ||
82 | /*
|
82 | /*
|
83 | * CONSTRAINT `fk_series_channel`
|
83 | * CONSTRAINT `fk_series_channel`
|
84 | * FOREIGN KEY (`channel_id` )
|
84 | * FOREIGN KEY (`channel_id` )
|
85 | * REFERENCES `series`.`channel` (`channel_id` )
|
85 | * REFERENCES `series`.`channel` (`channel_id` )
|
86 | * ON DELETE NO ACTION
|
86 | * ON DELETE NO ACTION
|
87 | * ON UPDATE NO ACTION
|
87 | * ON UPDATE NO ACTION
|
88 | */
|
88 | */
|
89 | /**
|
89 | /**
|
90 | * (non-PHPdoc)
|
90 | * (non-PHPdoc)
|
91 | * @see \PointedEars\PHPX\Db\Table::$_constraints
|
91 | * @see \PointedEars\PHPX\Db\Table::$_constraints
|
92 | */
|
92 | */
|
93 | protected static $_constraints = array( |
93 | protected static $_constraints = array( |
94 | 'foreign_keys' => array( |
94 | 'foreign_keys' => array( |
95 | 'fk_series_channel' => array( |
95 | 'fk_series_channel' => array( |
96 | 'columns' => array('channel_id'), |
96 | 'columns' => array('channel_id'), |
97 | 'references_table' => array('series', 'channel'), |
97 | 'references_table' => array('series', 'channel'), |
98 | 'references_columns' => array('channel_id'), |
98 | 'references_columns' => array('channel_id'), |
99 | 'rules' => array( |
99 | 'rules' => array( |
100 | 'ON DELETE' => 'NO ACTION', |
100 | 'ON DELETE' => 'NO ACTION', |
101 | 'ON UPDATE' => 'NO ACTION' |
101 | 'ON UPDATE' => 'NO ACTION' |
102 | )
|
102 | )
|
103 | )
|
103 | )
|
104 | )
|
104 | )
|
105 | ); |
105 | ); |
106 | 106 | ||
107 | /* ENGINE = InnoDB */
|
107 | /* ENGINE = InnoDB */
|
108 | /**
|
108 | /**
|
109 | * (non-PHPdoc)
|
109 | * (non-PHPdoc)
|
110 | * @see \PointedEars\PHPX\Db\MySQLTable::$_engine
|
110 | * @see \PointedEars\PHPX\Db\MySQLTable::$_engine
|
111 | */
|
111 | */
|
112 | protected static $_engine = 'InnoDB'; |
112 | protected static $_engine = 'InnoDB'; |
113 | }
|
113 | }
|