<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddFigmaUserIdToFileVersions extends Migration
{
	public function up()
	{
		$this->forge->addColumn('figma_file_versions', [
			'figma_user_id' => [
				'type' => 'VARCHAR',
				'constraint' => 255,
				'null' => true,
			],
		]);

		$this->db->query('CREATE INDEX idx_figma_file_versions_figma_user_id ON figma_file_versions(figma_user_id)');
	}

	public function down()
	{
		$this->db->query('DROP INDEX idx_figma_file_versions_figma_user_id ON figma_file_versions');
		$this->forge->dropColumn('figma_file_versions', 'figma_user_id');
	}
}
