Chunks.php 793 B

123456789101112131415161718192021222324252627282930313233
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. class NF_Database_Migrations_Chunks extends NF_Abstracts_Migration
  3. {
  4. /**
  5. * Constructor function for the chunks table migration.
  6. */
  7. public function __construct()
  8. {
  9. // Call the migration constructor with our table data.
  10. parent::__construct(
  11. 'nf3_chunks',
  12. 'nf_migration_create_table_chunks'
  13. );
  14. }
  15. /**
  16. * Function to define the chunks table.
  17. */
  18. public function run()
  19. {
  20. $query = "CREATE TABLE IF NOT EXISTS {$this->table_name()} (
  21. `id` int NOT NULL AUTO_INCREMENT,
  22. `name` varchar(200),
  23. `value` longtext,
  24. UNIQUE KEY (`id`)
  25. ) {$this->charset_collate()};";
  26. dbDelta( $query );
  27. }
  28. }