Initial Commit

This commit is contained in:
David Stone
2024-11-30 18:24:12 -07:00
commit e8f7955c1c
5432 changed files with 1397750 additions and 0 deletions

View File

@ -0,0 +1,121 @@
<?php
/**
* Class used for querying events.
*
* @package WP_Ultimo
* @subpackage Database\Event
* @since 2.0.0
*/
namespace WP_Ultimo\Database\Checkout_Forms;
use WP_Ultimo\Database\Engine\Table;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* Setup the "wu_events" database table
*
* @since 2.0.0
*/
final class Checkout_Forms_Table extends Table {
/**
* Table name
*
* @since 2.0.0
* @var string
*/
protected $name = 'forms';
/**
* Is this table global?
*
* @since 2.0.0
* @var boolean
*/
protected $global = true;
/**
* Table current version
*
* @since 2.0.0
* @var string
*/
protected $version = '2.0.1-revision.20230601';
/**
* List of table upgrades.
*
* @var array
*/
protected $upgrades = array(
'2.0.1-revision.20230601' => 20_230_601,
);
/**
* Event constructor.
*
* @access public
* @since 2.0.0
* @return void
*/
public function __construct() {
parent::__construct();
} // end __construct;
/**
* Setup the database schema
*
* @access protected
* @since 2.0.0
* @return void
*/
protected function set_schema() {
$this->schema = "id bigint(20) NOT NULL auto_increment,
name tinytext NOT NULL DEFAULT '',
slug varchar(255),
active tinyint(4) default 1,
settings longtext DEFAULT NULL,
custom_css longtext DEFAULT NULL,
allowed_countries text DEFAULT NULL,
date_created datetime DEFAULT NULL,
date_modified datetime DEFAULT NULL,
PRIMARY KEY (id)";
} // end set_schema;
/**
* Fixes the datetime columns to accept null.
*
* @since 2.1.2
*/
protected function __20230601(): bool {
$null_columns = array(
'date_created',
'date_modified',
);
foreach ($null_columns as $column) {
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
$result = $this->get_db()->query($query);
if (!$this->is_success($result)) {
return false;
} // end if;
} // end foreach;
return true;
} // end __20230601;
} // end class Checkout_Forms_Table;