table('devices'); $table ->addColumn('name', 'string', ['limit' => 255, 'null' => false]) ->addColumn('type', 'string', ['limit' => 30, 'null' => false, 'default' => 'unknown']) ->addColumn('description', 'text', ['null' => true]) ->addColumn('primary_ip', 'string', ['limit' => 45, 'null' => true]) ->addColumn('mac_address', 'string', ['limit' => 17, 'null' => true]) ->addColumn('hostname', 'string', ['limit' => 255, 'null' => true]) ->addColumn('vendor', 'string', ['limit' => 255, 'null' => true]) ->addColumn('os_name', 'string', ['limit' => 255, 'null' => true]) ->addColumn('os_version', 'string', ['limit' => 255, 'null' => true]) ->addColumn('location', 'string', ['limit' => 255, 'null' => true]) ->addColumn('importance', 'string', ['limit' => 20, 'null' => false, 'default' => 'normal']) ->addColumn('status', 'string', ['limit' => 20, 'null' => false, 'default' => 'active']) ->addColumn('created_at', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']) ->addColumn('updated_at', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']) ->addIndex(['primary_ip']) ->addIndex(['mac_address'], ['unique' => true]) ->addIndex(['type']) ->addIndex(['status']) ->create(); } }