70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateDapodikSyncJobsTable extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'BIGINT',
|
|
'constraint' => 20,
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'type' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 50,
|
|
'comment' => 'students|classes',
|
|
],
|
|
'total_rows' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'default' => 0,
|
|
],
|
|
'processed_rows' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'default' => 0,
|
|
],
|
|
'status' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 20,
|
|
'default' => 'pending',
|
|
'comment' => 'pending|running|completed|failed',
|
|
],
|
|
'message' => [
|
|
'type' => 'TEXT',
|
|
'null' => true,
|
|
],
|
|
'started_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'finished_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addKey('status');
|
|
$this->forge->createTable('dapodik_sync_jobs');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('dapodik_sync_jobs');
|
|
}
|
|
}
|