NF_Database_Migrations

The Ninja Forms NF Database Migrations class.

Defined (1)

The class is defined in the following location(s).

/includes/Database/Migrations.php  
  1. class NF_Database_Migrations 
  2. protected $migrations = array(); 
  3.  
  4. public function __construct() 
  5. $this->migrations[ 'forms' ] = new NF_Database_Migrations_Forms(); 
  6. $this->migrations[ 'form_meta' ] = new NF_Database_Migrations_FormMeta(); 
  7. $this->migrations[ 'fields' ] = new NF_Database_Migrations_Fields(); 
  8. $this->migrations[ 'field_meta' ] = new NF_Database_Migrations_FieldMeta(); 
  9. $this->migrations[ 'actions' ] = new NF_Database_Migrations_Actions(); 
  10. $this->migrations[ 'action_meta' ] = new NF_Database_Migrations_ActionMeta(); 
  11. $this->migrations[ 'objects' ] = new NF_Database_Migrations_Objects(); 
  12. $this->migrations[ 'object_meta' ] = new NF_Database_Migrations_ObjectMeta(); 
  13. $this->migrations[ 'relationships' ] = new NF_Database_Migrations_Relationships(); 
  14. $this->migrations[ 'settings' ] = new NF_Database_Migrations_Settings(); 
  15.  
  16. public function migrate() 
  17. foreach( $this->migrations as $migration ) { 
  18. $migration->_run(); 
  19.  
  20. public function nuke( $areYouSure = FALSE, $areYouReallySure = FALSE ) 
  21. if( ! $areYouSure || ! $areYouReallySure ) return; 
  22.  
  23. global $wpdb; 
  24.  
  25. foreach( $this->migrations as $migration ) { 
  26.  
  27. if( ! $migration->table_name ) continue; 
  28.  
  29. if( 0 == $wpdb->query( "SHOW TABLES LIKE '" . $migration->table_name . "'" ) ) continue; 
  30.  
  31. $wpdb->query( "DROP TABLE $migration->table_name" ); 
  32.  
  33.