| @@ 13-68 (lines=56) @@ | ||
| 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 | public static function depends_on() |
|
| 27 | { |
|
| 28 | return array( |
|
| 29 | '\phpbb\ads\migrations\v10x\m1_initial_schema', |
|
| 30 | '\phpbb\ads\migrations\v10x\m4_indexes', |
|
| 31 | '\phpbb\ads\migrations\v10x\m9_views_clicks', |
|
| 32 | ); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * Add the ad owner to ads table |
|
| 37 | * |
|
| 38 | * @return array Array of table schema |
|
| 39 | * @access public |
|
| 40 | */ |
|
| 41 | public function update_schema() |
|
| 42 | { |
|
| 43 | return array( |
|
| 44 | 'add_columns' => array( |
|
| 45 | $this->table_prefix . 'ads' => array( |
|
| 46 | 'ad_owner' => array('UINT', 0), |
|
| 47 | ), |
|
| 48 | ), |
|
| 49 | ); |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * Drop the ad owner from ads table |
|
| 54 | * |
|
| 55 | * @return array Array of table schema |
|
| 56 | * @access public |
|
| 57 | */ |
|
| 58 | public function revert_schema() |
|
| 59 | { |
|
| 60 | return array( |
|
| 61 | 'drop_columns' => array( |
|
| 62 | $this->table_prefix . 'ads' => array( |
|
| 63 | 'ad_owner', |
|
| 64 | ), |
|
| 65 | ), |
|
| 66 | ); |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| @@ 13-67 (lines=55) @@ | ||
| 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 | public static function depends_on() |
|
| 27 | { |
|
| 28 | return array( |
|
| 29 | '\phpbb\ads\migrations\v10x\m1_initial_schema', |
|
| 30 | '\phpbb\ads\migrations\v10x\m4_indexes', |
|
| 31 | ); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Add the end date 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_end_date' => array('TIMESTAMP', 0), |
|
| 46 | ), |
|
| 47 | ), |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Drop the end date 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_end_date', |
|
| 63 | ), |
|
| 64 | ), |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 13-67 (lines=55) @@ | ||
| 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 | public static function depends_on() |
|
| 27 | { |
|
| 28 | return array( |
|
| 29 | '\phpbb\ads\migrations\v10x\m1_initial_schema', |
|
| 30 | '\phpbb\ads\migrations\v10x\m4_indexes', |
|
| 31 | ); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Add the priority 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_priority' => array('TINT:2', 5), |
|
| 46 | ), |
|
| 47 | ), |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Drop the priority 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_priority', |
|
| 63 | ), |
|
| 64 | ), |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 13-67 (lines=55) @@ | ||
| 10 | ||
| 11 | namespace phpbb\ads\migrations\v20x; |
|
| 12 | ||
| 13 | class m2_centering_option 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_centering'); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * {@inheritDoc} |
|
| 25 | */ |
|
| 26 | public static function depends_on() |
|
| 27 | { |
|
| 28 | return array( |
|
| 29 | '\phpbb\ads\migrations\v10x\m1_initial_schema', |
|
| 30 | '\phpbb\ads\migrations\v10x\m4_indexes', |
|
| 31 | ); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Add the centering option 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_centering' => array('BOOL', 1), |
|
| 46 | ), |
|
| 47 | ), |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Drop the centering option 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_centering', |
|
| 63 | ), |
|
| 64 | ), |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 13-67 (lines=55) @@ | ||
| 10 | ||
| 11 | namespace phpbb\ads\migrations\v20x; |
|
| 12 | ||
| 13 | class m3_add_start_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_start_date'); |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * {@inheritDoc} |
|
| 25 | */ |
|
| 26 | public static function depends_on() |
|
| 27 | { |
|
| 28 | return [ |
|
| 29 | '\phpbb\ads\migrations\v10x\m1_initial_schema', |
|
| 30 | '\phpbb\ads\migrations\v10x\m4_indexes', |
|
| 31 | ]; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Add the start date option to ads table |
|
| 36 | * |
|
| 37 | * @return array Array of table schema |
|
| 38 | * @access public |
|
| 39 | */ |
|
| 40 | public function update_schema() |
|
| 41 | { |
|
| 42 | return [ |
|
| 43 | 'add_columns' => [ |
|
| 44 | $this->table_prefix . 'ads' => [ |
|
| 45 | 'ad_start_date' => ['TIMESTAMP', 0], |
|
| 46 | ], |
|
| 47 | ], |
|
| 48 | ]; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Drop the start date option from ads table |
|
| 53 | * |
|
| 54 | * @return array Array of table schema |
|
| 55 | * @access public |
|
| 56 | */ |
|
| 57 | public function revert_schema() |
|
| 58 | { |
|
| 59 | return [ |
|
| 60 | 'drop_columns' => [ |
|
| 61 | $this->table_prefix . 'ads' => [ |
|
| 62 | 'ad_start_date', |
|
| 63 | ], |
|
| 64 | ], |
|
| 65 | ]; |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||