Fields.php 722 B

1234567891011121314151617181920212223242526272829
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. class NF_Database_Migrations_Fields extends NF_Abstracts_Migration
  3. {
  4. public function __construct()
  5. {
  6. parent::__construct(
  7. 'nf3_fields',
  8. 'nf_migration_create_table_fields'
  9. );
  10. }
  11. public function run()
  12. {
  13. $query = "CREATE TABLE IF NOT EXISTS {$this->table_name()} (
  14. `id` int NOT NULL AUTO_INCREMENT,
  15. `label` longtext,
  16. `key` longtext,
  17. `type` longtext,
  18. `parent_id` int NOT NULL,
  19. `created_at` TIMESTAMP,
  20. `updated_at` DATETIME,
  21. UNIQUE KEY (`id`)
  22. ) {$this->charset_collate()};";
  23. dbDelta( $query );
  24. }
  25. }