$41 GRAYBYTE WORDPRESS FILE MANAGER $11

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.51
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/bravetechrwanda/itiministry.org/plugins/give/src/Subscriptions/Migrations/

HOME
Current File : /home/bravetechrwanda/itiministry.org/plugins/give/src/Subscriptions/Migrations//AddCampaignId.php
<?php

namespace Give\Subscriptions\Migrations;

use Give\Framework\Database\DB;
use Give\Framework\Database\Exceptions\DatabaseQueryException;
use Give\Framework\Migrations\Contracts\Migration;
use Give\Framework\Migrations\Contracts\ReversibleMigration;
use Give\Framework\Migrations\Exceptions\DatabaseMigrationException;

/**
 * @since 4.11.0
 */
class AddCampaignId extends Migration implements ReversibleMigration
{
    /**
     * @inheritDoc
     */
    public static function id(): string
    {
        return 'add_campaign_id_to_subscriptions';
    }

    /**
     * @inheritDoc
     */
    public static function title(): string
    {
        return 'Add campaign id to subscriptions';
    }

    /**
     * @inheritdoc
     */
    public static function timestamp(): string
    {
        return strtotime('2025-10-16 00:00:00');
    }

    /**
     * @inheritDoc
     *
     * @throws DatabaseMigrationException
     */
    public function run()
    {
        try {
            $query = <<<SQL
                UPDATE %s AS subscriptions
                JOIN %s campaignForms
                    ON subscriptions.product_id = campaignForms.form_id
                SET subscriptions.campaign_id = campaignForms.campaign_id
            SQL;

            DB::query(sprintf(
                $query,
                DB::prefix('give_subscriptions'),
                DB::prefix('give_campaign_forms')
            ));
        } catch (DatabaseQueryException $exception) {
            throw new DatabaseMigrationException("An error occurred while adding campaign ID to the give_subscriptions table",
                0, $exception);
        }
    }


    /**
     * @inheritDoc
     */
    public function reverse(): void
    {
        DB::table('give_subscriptions')->update(['campaign_id' => null]);
    }
}

Current_dir [ WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
25 May 2026 4.20 PM
bravetechrwanda / bravetechrwanda
0755
AddCampaignId.php
1.769 KB
30 Oct 2025 12.17 AM
bravetechrwanda / bravetechrwanda
0644
AddCampaignIdColumn.php
1.123 KB
16 Oct 2025 6.10 PM
bravetechrwanda / bravetechrwanda
0644
AddPaymentModeToSubscriptionTable.php
2.971 KB
19 Jan 2023 12.19 AM
bravetechrwanda / bravetechrwanda
0644
BackfillMissingCampaignIdForDonations.php
13.218 KB
11 Jun 2025 10.57 PM
bravetechrwanda / bravetechrwanda
0644
CreateSubscriptionTables.php
2.831 KB
1 Apr 2022 2.56 AM
bravetechrwanda / bravetechrwanda
0644
UpdateProductID.php
1.995 KB
30 Oct 2025 12.17 AM
bravetechrwanda / bravetechrwanda
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF