prefix . 'askshelf_conversations'; } /** * Creates or updates tables with dbDelta. */ public static function create_tables(): void { global $wpdb; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $table = self::conversations_table(); $charset = $wpdb->get_charset_collate(); dbDelta( "CREATE TABLE {$table} ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, user_id bigint(20) unsigned NOT NULL, title varchar(200) NOT NULL DEFAULT '', summary varchar(255) NOT NULL DEFAULT '', tag varchar(4) NOT NULL DEFAULT '', tone varchar(8) NOT NULL DEFAULT '', messages longtext NOT NULL, created_at datetime NOT NULL, updated_at datetime NOT NULL, PRIMARY KEY (id), KEY user_updated (user_id,updated_at) ) {$charset};" ); update_option( self::DB_VERSION_OPTION, self::DB_VERSION, false ); } }