<?php if ( ! defined( 'ABSPATH' ) ) exit;
class NF_Database_Migrations_Fields extends NF_Abstracts_Migration
* Constructor method for the NF_Database_Migrations_Fields class.
public function __construct()
'nf_migration_create_table_fields'
* Function to run our initial migration.
$query = "CREATE TABLE IF NOT EXISTS {$this->table_name()} (
`id` int NOT NULL AUTO_INCREMENT,
`parent_id` int NOT NULL,
`default_value` longtext,
`personally_identifiable` bit,
) {$this->charset_collate( true )};";
* Function to run our stage two upgrades.
public function cache_collate_fields()
// If the field_label column has not already been defined...
if ( ! $this->column_exists( 'field_label' ) ) {
$query = "ALTER TABLE {$this->table_name()}
ADD `field_label` longtext {$this->charset_collate()},
ADD `field_key` longtext {$this->charset_collate()},
ADD `default_value` longtext {$this->charset_collate()},
ADD `label_pos` varchar(15) {$this->charset_collate()},
ADD `personally_identifiable` bit,
MODIFY `type` longtext {$this->charset_collate()};";