migrations/Version20250127102900.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\Migrations\AbstractMigration;
  7. final class Version20250127102900 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return 'Add inquiry table';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->skipIf($schema->hasTable('inquiry'), 'Table inquiry already exists');
  16.         $table $schema->createTable('inquiry');
  17.         $table->addColumn('id'Types::GUID)->setNotnull(true);
  18.         $table->addColumn('ged_id'Types::STRING)->setLength(15)->setNotnull(true);
  19.         $table->addColumn('added_at'Types::DATETIME_IMMUTABLE)->setNotnull(true);
  20.         $table->addColumn('source_channel'Types::STRING)->setLength(20)->setNotnull(true);
  21.         $table->addColumn('total_page_count'Types::INTEGER)->setNotnull(true);
  22.         $table->addColumn('status'Types::STRING)->setLength(20)->setNotnull(true);
  23.         $table->addColumn('assigned_department_id'Types::STRING)->setLength(255)->setNotnull(true);
  24.         $table->addColumn('assigned_employee_id'Types::STRING)->setLength(255)->setNotnull(false)->setDefault(null);
  25.         $table->addColumn('health_insurance_pages'Types::JSON)->setNotnull(false);
  26.         $table->addColumn('ignored_pages'Types::JSON)->setNotnull(false);
  27.         $table->addColumn('ocr_data'Types::JSON)->setNotnull(false);
  28.         $table->setPrimaryKey(['id']);
  29.         $table->addIndex(['ged_id'], 'idx_ged_id');
  30.         $table->addForeignKeyConstraint('department', ['assigned_department_id'], ['id'], [], 'fk_inquiry_department');
  31.         $table->addForeignKeyConstraint('employee', ['assigned_employee_id'], ['id'], [], 'fk_inquiry_employee');
  32.     }
  33.     public function down(Schema $schema): void
  34.     {
  35.         $this->skipIf(!$schema->hasTable('inquiry'), 'Table inquiry does not exist');
  36.         $schema->dropTable('inquiry');
  37.     }
  38. }