| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentSupport\Database\Migrations; |
| 4 |
|
| 5 |
class ActivityMigrator |
| 6 |
{ |
| 7 |
static $tableName = 'fs_activities'; |
| 8 |
|
| 9 |
public static function migrate() |
| 10 |
{ |
| 11 |
global $wpdb; |
| 12 |
|
| 13 |
$charsetCollate = $wpdb->get_charset_collate(); |
| 14 |
|
| 15 |
$table = $wpdb->prefix . static::$tableName; |
| 16 |
|
| 17 |
if ($wpdb->get_var("SHOW TABLES LIKE '$table'") != $table) { |
| 18 |
$sql = "CREATE TABLE $table ( |
| 19 |
`id` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| 20 |
`person_id` BIGINT(20) NULL, |
| 21 |
`person_type` VARCHAR(192) NULL, |
| 22 |
`event_type` VARCHAR(192) NULL, |
| 23 |
`object_id` BIGINT(20) NULL, |
| 24 |
`object_type` VARCHAR(192) NULL, |
| 25 |
`description` MEDIUMTEXT NULL, |
| 26 |
`created_at` TIMESTAMP NULL, |
| 27 |
`updated_at` TIMESTAMP NULL |
| 28 |
) $charsetCollate;"; |
| 29 |
dbDelta($sql); |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
|