Current Path : /storage/v11800/affypharma/public_html/wp-content/plugins/ninja-tables/database/Migrations/ |
Linux v11800 5.3.0-1023-aws #25~18.04.1-Ubuntu SMP Fri Jun 5 15:19:18 UTC 2020 aarch64
|
Current File : /storage/v11800/affypharma/public_html/wp-content/plugins/ninja-tables/database/Migrations/ExampleMigrator.php |
<?php
namespace NinjaTables\Database\Migrations;
class ExampleMigrator
{
static $tableName = 'example';
public static function migrate()
{
global $wpdb;
$charsetCollate = $wpdb->get_charset_collate();
$table = $wpdb->prefix . static::$tableName;
if ($wpdb->get_var("SHOW TABLES LIKE '$table'") != $table) {
$sql = "CREATE TABLE $table (
`id` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
`title` VARCHAR(100) NOT NULL,
`description` TEXT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
) $charsetCollate;";
dbDelta($sql);
}
}
}