| @@ 13-64 (lines=52) @@ | ||
| 10 | ||
| 11 | namespace phpbb\ads\migrations\v10x; |
|
| 12 | ||
| 13 | class m5_end_date extends \phpbb\db\migration\migration |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * {@inheritDoc} |
|
| 17 | */ |
|
| 18 | public function effectively_installed() |
|
| 19 | { |
|
| 20 | return $this->db_tools->sql_column_exists($this->table_prefix . 'ads', 'ad_end_date'); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * {@inheritDoc} |
|
| 25 | */ |
|
| 26 | static public function depends_on() |
|
| 27 | { |
|
| 28 | return array('\phpbb\ads\migrations\v10x\m1_initial_schema'); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Add the end date to ads table |
|
| 33 | * |
|
| 34 | * @return array Array of table schema |
|
| 35 | * @access public |
|
| 36 | */ |
|
| 37 | public function update_schema() |
|
| 38 | { |
|
| 39 | return array( |
|
| 40 | 'add_columns' => array( |
|
| 41 | $this->table_prefix . 'ads' => array( |
|
| 42 | 'ad_end_date' => array('TIMESTAMP', 0), |
|
| 43 | ), |
|
| 44 | ), |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Drop the end date from ads table |
|
| 50 | * |
|
| 51 | * @return array Array of table schema |
|
| 52 | * @access public |
|
| 53 | */ |
|
| 54 | public function revert_schema() |
|
| 55 | { |
|
| 56 | return array( |
|
| 57 | 'drop_columns' => array( |
|
| 58 | $this->table_prefix . 'ads' => array( |
|
| 59 | 'ad_end_date', |
|
| 60 | ), |
|
| 61 | ), |
|
| 62 | ); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| @@ 13-64 (lines=52) @@ | ||
| 10 | ||
| 11 | namespace phpbb\ads\migrations\v10x; |
|
| 12 | ||
| 13 | class m8_priority extends \phpbb\db\migration\migration |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * {@inheritDoc} |
|
| 17 | */ |
|
| 18 | public function effectively_installed() |
|
| 19 | { |
|
| 20 | return $this->db_tools->sql_column_exists($this->table_prefix . 'ads', 'ad_priority'); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * {@inheritDoc} |
|
| 25 | */ |
|
| 26 | static public function depends_on() |
|
| 27 | { |
|
| 28 | return array('\phpbb\ads\migrations\v10x\m1_initial_schema'); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * Add the priority to ads table |
|
| 33 | * |
|
| 34 | * @return array Array of table schema |
|
| 35 | * @access public |
|
| 36 | */ |
|
| 37 | public function update_schema() |
|
| 38 | { |
|
| 39 | return array( |
|
| 40 | 'add_columns' => array( |
|
| 41 | $this->table_prefix . 'ads' => array( |
|
| 42 | 'ad_priority' => array('TINT:2', 5), |
|
| 43 | ), |
|
| 44 | ), |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Drop the priority from ads table |
|
| 50 | * |
|
| 51 | * @return array Array of table schema |
|
| 52 | * @access public |
|
| 53 | */ |
|
| 54 | public function revert_schema() |
|
| 55 | { |
|
| 56 | return array( |
|
| 57 | 'drop_columns' => array( |
|
| 58 | $this->table_prefix . 'ads' => array( |
|
| 59 | 'ad_priority', |
|
| 60 | ), |
|
| 61 | ), |
|
| 62 | ); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| @@ 13-67 (lines=55) @@ | ||
| 10 | ||
| 11 | namespace phpbb\ads\migrations\v10x; |
|
| 12 | ||
| 13 | class m10_ad_owner_schema extends \phpbb\db\migration\migration |
|
| 14 | { |
|
| 15 | /** |
|
| 16 | * {@inheritDoc} |
|
| 17 | */ |
|
| 18 | public function effectively_installed() |
|
| 19 | { |
|
| 20 | return $this->db_tools->sql_column_exists($this->table_prefix . 'ads', 'ad_owner'); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * {@inheritDoc} |
|
| 25 | */ |
|
| 26 | static public function depends_on() |
|
| 27 | { |
|
| 28 | return array( |
|
| 29 | '\phpbb\ads\migrations\v10x\m1_initial_schema', |
|
| 30 | '\phpbb\ads\migrations\v10x\m9_views_clicks', |
|
| 31 | ); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Add the ad owner to ads table |
|
| 36 | * |
|
| 37 | * @return array Array of table schema |
|
| 38 | * @access public |
|
| 39 | */ |
|
| 40 | public function update_schema() |
|
| 41 | { |
|
| 42 | return array( |
|
| 43 | 'add_columns' => array( |
|
| 44 | $this->table_prefix . 'ads' => array( |
|
| 45 | 'ad_owner' => array('UINT', 0), |
|
| 46 | ), |
|
| 47 | ), |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Drop the ad owner from ads table |
|
| 53 | * |
|
| 54 | * @return array Array of table schema |
|
| 55 | * @access public |
|
| 56 | */ |
|
| 57 | public function revert_schema() |
|
| 58 | { |
|
| 59 | return array( |
|
| 60 | 'drop_columns' => array( |
|
| 61 | $this->table_prefix . 'ads' => array( |
|
| 62 | 'ad_owner', |
|
| 63 | ), |
|
| 64 | ), |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||