PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.13.2
GiveWP – Donation Plugin and Fundraising Platform v4.13.2
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / Campaigns / Migrations / RevenueTable / AddCampaignID.php
AddCampaignID.php
52 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Campaigns\Migrations\RevenueTable;
4
5 use Give\Framework\Database\DB;
6 use Give\Framework\Migrations\Contracts\Migration;
7 use Give\Framework\Migrations\Exceptions\DatabaseMigrationException;
8
9 /**
10 * @since 4.0.0
11 */
12 class AddCampaignID extends Migration
13 {
14 /**
15 * @inheritDoc
16 */
17 public static function id(): string
18 {
19 return 'add_campaign_id_to_revenue_table';
20 }
21
22 /**
23 * @inheritDoc
24 */
25 public static function title(): string
26 {
27 return 'Add Campaign ID to revenue table';
28 }
29
30 /**
31 * @inheritdoc
32 */
33 public static function timestamp(): string
34 {
35 return strtotime('2024-10-14 00:00:00');
36 }
37
38 /**
39 * @inheritDoc
40 * @throws DatabaseMigrationException
41 */
42 public function run()
43 {
44 $table = DB::prefix('give_revenue');
45 $columnAdded = maybe_add_column($table, 'campaign_id', "ALTER TABLE $table ADD COLUMN campaign_id INT UNSIGNED NULL");
46
47 if ( ! $columnAdded) {
48 throw new DatabaseMigrationException("An error occurred while updating the $table table");
49 }
50 }
51 }
52