<?php

use Phalcon\Mvc\Model\Migration;

class BeritaTagsMigration_363 extends Migration
{
    public function up()
    {
        $this->down();

        self::$connection->execute('
            CREATE TABLE jaga.tags(
                id serial primary key,
                label char varying (255) not null,
                created_at timestamp(6) DEFAULT now(),
                updated_at timestamp(6),
                deleted_at timestamp(6)
            );
        ');

        self::$connection->execute('
            CREATE TABLE jaga.berita_tags(
                id bigserial primary key,
                id_diskusi int not null,
                id_tags int not null,
                created_at timestamp(6) DEFAULT now(),
                updated_at timestamp(6),
                deleted_at timestamp(6)
            );
        ');
    }

    public function down()
    {
        self::$connection->execute('
            DROP TABLE IF EXISTS jaga.tags;
        ');

        self::$connection->execute('
            DROP TABLE IF EXISTS jaga.berita_tags;
        ');
    }
}
