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 / Donors / Migrations / AddPhoneColumn.php

AddPhoneColumn.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Donors/Migrations/AddPhoneColumn.php

61 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Donors\Migrations;
4
5 use Give\Framework\Database\Exceptions\DatabaseQueryException;
6 use Give\Framework\Migrations\Contracts\Migration;
7 use Give\Framework\Migrations\Exceptions\DatabaseMigrationException;
8
9 /**
10 * @since 3.7.0
11 */
12 class AddPhoneColumn extends Migration
13 {
14 /**
15 * @since 3.7.0
16 *
17 * @throws DatabaseMigrationException
18 */
19 public function run()
20 {
21 global $wpdb;
22
23 $donorsTableName = "{$wpdb->prefix}give_donors";
24
25 try {
26 maybe_add_column(
27 $donorsTableName,
28 'phone',
29 "ALTER TABLE `$donorsTableName` ADD COLUMN `phone` varchar(50) NOT NULL DEFAULT '' AFTER `name`"
30 );
31 } catch (DatabaseQueryException $exception) {
32 throw new DatabaseMigrationException('An error occurred adding the phone column to the donors table',
33 0, $exception);
34 }
35 }
36
37 /**
38 * @since 3.7.0
39 */
40 public static function id(): string
41 {
42 return 'donors-add-phone-column';
43 }
44
45 /**
46 * @since 3.7.0
47 */
48 public static function title(): string
49 {
50 return 'Add phone column to donors table';
51 }
52
53 /**
54 * @since 3.7.0
55 */
56 public static function timestamp()
57 {
58 return strtotime('2024-03-26');
59 }
60 }
61