PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 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 All 255 releases
give / src / Campaigns / Migrations / RevenueTable / AddIndexes.php

AddIndexes.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Campaigns/Migrations/RevenueTable/AddIndexes.php

55 lines 1.2 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\Database\Exceptions\DatabaseQueryException;
7 use Give\Framework\Migrations\Contracts\Migration;
8 use Give\Framework\Migrations\Exceptions\DatabaseMigrationException;
9
10 /**
11 * @since 4.0.0
12 */
13 class AddIndexes extends Migration
14 {
15 /**
16 * @inheritDoc
17 */
18 public static function id(): string
19 {
20 return 'add_indexes_to_revenue_table';
21 }
22
23 /**
24 * @inheritDoc
25 */
26 public static function title(): string
27 {
28 return 'Add indexes to revenue table';
29 }
30
31 /**
32 * @inheritdoc
33 */
34 public static function timestamp(): string
35 {
36 return strtotime('2024-10-14 00:00:02');
37 }
38
39 /**
40 * @inheritDoc
41 * @throws DatabaseMigrationException
42 */
43 public function run()
44 {
45 global $wpdb;
46
47 try {
48 DB::query("ALTER TABLE {$wpdb->give_revenue} ADD INDEX (form_id), ADD INDEX (campaign_id)");
49 } catch (DatabaseQueryException $exception) {
50 throw new DatabaseMigrationException("An error occurred while updating the {$wpdb->give_revenue} table", 0,
51 $exception);
52 }
53 }
54 }
55