MIF_E31210104/app/Database/Migrations/2024-05-11-030036_Ticket.php

49 lines
1.2 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class Ticket extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'id_pelanggan' => [
'type' => 'INT',
'constraint' => 11,
],
'keluhan' => [
'type' => 'TEXT',
],
'status' => [
'type' => 'ENUM',
'constraint' => ['1', '0'],
'default' => '0',
],
'created_at' => [
'type' => 'TIMESTAMP',
'default' => new RawSql('CURRENT_TIMESTAMP'),
],
'updated_at' => [
'type' => 'TIMESTAMP',
'default' => new RawSql('CURRENT_TIMESTAMP'),
],
]);
$this->forge->addKey('id', true);
$this->forge->createTable('ticket');
}
public function down()
{
$this->forge->dropTable('ticket');
}
}