<?php 

use Phalcon\Db\Column;
use Phalcon\Db\Index;
use Phalcon\Db\Reference;
use Phalcon\Mvc\Model\Migration;

class SpiChartDekstopMigration_268 extends Migration
{
    public function up()
    {
        self::$connection->execute("
            --[1]
                
            DROP TABLE if exists jaga.spi_chart_dekstop;
            DROP SEQUENCE if exists jaga.spi_chart_dekstop_id_seq;
            
            CREATE SEQUENCE jaga.spi_chart_dekstop_id_seq
                INCREMENT 1
                START 1
                MINVALUE 1
                MAXVALUE 9223372036854775807
                CACHE 1;

            CREATE TABLE jaga.spi_chart_dekstop
            (
                id integer NOT NULL DEFAULT nextval('jaga.spi_chart_dekstop_id_seq'::regclass),
                tahun character varying(4) COLLATE pg_catalog.\"default\" NOT NULL,
                code_klpd integer,
                nama_klpd character varying COLLATE pg_catalog.\"default\" NOT NULL,
                
                female_num_in integer default 0,
                male_num_in integer default 0,
                min30_in integer default 0,
                range30to50_in integer default 0,
                max50_in integer default 0,
                
                female_num_ek integer default 0,
                male_num_ek integer default 0,
                min30_ek integer default 0,
                range30to50_ek integer default 0,
                max50_ek integer default 0,

                jbtn_ex_sarjana integer default 0,
                jbtn_ex_s1 integer default 0,

                hasil_spi double precision NOT NULL,
                hasil_spi_internal double precision NOT NULL,
                hasil_spi_eksternal double precision NOT NULL,
                hasil_spi_expert double precision NOT NULL,

                is_active boolean default true,
                CONSTRAINT spi_chart_dekstop_pkey PRIMARY KEY (id)
            );
        ");
    }
}