Relationships.php 782 B

1234567891011121314151617181920212223242526272829
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. class NF_Database_Migrations_Relationships extends NF_Abstracts_Migration
  3. {
  4. public function __construct()
  5. {
  6. parent::__construct(
  7. 'nf3_relationships',
  8. 'nf_migration_create_table_relationships'
  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. `child_id` int NOT NULL,
  16. `child_type` longtext NOT NULL,
  17. `parent_id` int NOT NULL,
  18. `parent_type` longtext NOT NULL,
  19. `created_at` TIMESTAMP,
  20. `updated_at` DATETIME,
  21. UNIQUE KEY (`id`)
  22. ) {$this->charset_collate()};";
  23. dbDelta( $query );
  24. }
  25. }