Server IP : 192.158.238.246 / Your IP : 3.137.214.24 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/task/7779/cwd/plugins/give/src/MigrationLog/Migrations/ |
Upload File : |
<?php namespace Give\MigrationLog\Migrations; use Give\Framework\Database\DB; use Give\Framework\Database\Exceptions\DatabaseQueryException; use Give\Framework\Migrations\Contracts\Migration; use Give\Framework\Migrations\Exceptions\DatabaseMigrationException; /** * Class CreateMigrationsTable * @package Give\MigrationLog\Migrations * * @since 2.10.0 */ class CreateMigrationsTable extends Migration { /** * @return string */ public static function id() { return 'create_migrations_table'; } /** * @return string */ public static function title() { return esc_html__('Create new give_migrations table', 'give'); } /** * @return int */ public static function timestamp() { /** * For this migration, we have to use the earliest possible date because we will be using * the table created with this migration to store the status of the migration */ return strtotime('1970-01-01 00:00'); } /** * @since 2.21.0 Add Check whether table installed before adding it to database. * @throws DatabaseMigrationException */ public function run() { $table = DB::prefix('give_migrations'); $charset = DB::get_charset_collate(); $sql = "CREATE TABLE IF NOT EXISTS {$table} ( id VARCHAR(180) NOT NULL, status VARCHAR(16) NOT NULL, error text NULL, last_run DATETIME NOT NULL, PRIMARY KEY (id) ) {$charset}"; try { DB::delta($sql); } catch (DatabaseQueryException $exception) { throw new DatabaseMigrationException("An error occurred while creating the {$table} table", 0, $exception); } } }