<?php

namespace Signteer\Core\Database;

use Plainwork\Database\Database;

class SignupFieldTable
{
    public const NAME = '__signup_field';
    public const COL_ID = 'id';
    public const COL_TYPE = 'field_type';
    public const COL_LABEL = 'field_label';
    public const COL_ENABLED = 'is_enabled';

    public function up1($db)
    {
        $cols = [
            self::COL_ID => ['type' => 'VARCHAR(32)', 'null' => false, 'primaryKey' => true],
            self::COL_TYPE => ['type' => 'VARCHAR(16)', 'null' => false],
            self::COL_LABEL => ['type' => 'VARCHAR(255)', 'null' => false],
            self::COL_ENABLED => ['type' => 'TINYINT', 'null' => false],
        ];
        $db->createTable(self::NAME, $cols);
    }

    public function down1($db)
    {
        $db->dropTable(self::NAME);
    }
}
