96 lines
2.8 KiB
PHP
96 lines
2.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class CreateCadAreaJobsTable extends AbstractMigration
|
|
{
|
|
public function change(): void
|
|
{
|
|
$table = $this->table('cad_area_jobs');
|
|
|
|
$table
|
|
->addColumn('iduser', 'integer', [
|
|
'null' => true,
|
|
'signed' => false,
|
|
'limit' => 10,
|
|
])
|
|
->addColumn('original_filename', 'string', [
|
|
'limit' => 255,
|
|
'null' => false,
|
|
])
|
|
->addColumn('stored_filename', 'string', [
|
|
'limit' => 255,
|
|
'null' => false,
|
|
])
|
|
->addColumn('file_path', 'string', [
|
|
'limit' => 500,
|
|
'null' => false,
|
|
])
|
|
->addColumn('file_url', 'string', [
|
|
'limit' => 500,
|
|
'null' => true,
|
|
])
|
|
->addColumn('file_size', 'integer', [
|
|
'null' => true,
|
|
'signed' => false,
|
|
])
|
|
->addColumn('status', 'enum', [
|
|
'values' => [
|
|
'uploaded',
|
|
'processing',
|
|
'completed',
|
|
'error',
|
|
],
|
|
'default' => 'uploaded',
|
|
'null' => false,
|
|
])
|
|
->addColumn('area_mm2', 'decimal', [
|
|
'precision' => 18,
|
|
'scale' => 6,
|
|
'null' => true,
|
|
])
|
|
->addColumn('area_cm2', 'decimal', [
|
|
'precision' => 18,
|
|
'scale' => 6,
|
|
'null' => true,
|
|
])
|
|
->addColumn('area_m2', 'decimal', [
|
|
'precision' => 18,
|
|
'scale' => 9,
|
|
'null' => true,
|
|
])
|
|
->addColumn('scale_detected', 'string', [
|
|
'limit' => 50,
|
|
'null' => true,
|
|
])
|
|
->addColumn('confidence', 'string', [
|
|
'limit' => 50,
|
|
'null' => true,
|
|
])
|
|
->addColumn('message', 'text', [
|
|
'null' => true,
|
|
])
|
|
->addColumn('python_response', 'text', [
|
|
'null' => true,
|
|
])
|
|
->addColumn('created_at', 'timestamp', [
|
|
'default' => 'CURRENT_TIMESTAMP',
|
|
'null' => true,
|
|
])
|
|
->addColumn('updated_at', 'timestamp', [
|
|
'default' => 'CURRENT_TIMESTAMP',
|
|
'update' => 'CURRENT_TIMESTAMP',
|
|
'null' => true,
|
|
])
|
|
->addIndex(['iduser'], [
|
|
'name' => 'idx_cad_area_jobs_iduser',
|
|
])
|
|
->addIndex(['status'], [
|
|
'name' => 'idx_cad_area_jobs_status',
|
|
])
|
|
->create();
|
|
}
|
|
}
|