<?php

use Licenzo\Framework\Database\Migration\Migration;

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

return new class extends Migration {
    protected $table = 'licenzo_meta';

    public function up()
    {
        return $this->create($this->table, [
            'id'          => 'BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY',
            'entity_type' => 'VARCHAR(200) NOT NULL',
            'entity_id'   => 'BIGINT UNSIGNED NOT NULL',
            // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
            'meta_key'    => 'VARCHAR(255) NOT NULL',
            // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
            'meta_value'  => 'LONGTEXT NULL',
            'created_at'  => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
            'updated_at'  => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
        ]);
    }

    public function down()
    {
        return $this->drop($this->table);
    }
};
