<?php

use Phinx\Migration\AbstractMigration;

class CreateCinemaTables extends AbstractMigration
{
    public function change()
    {
        $movies = $this->table("movies", ['id' => true, 'primary_key' => 'id']);
        $movies->addColumn('kinopoisk_id', 'integer')
               ->addColumn('name', 'string')
               ->addColumn('poster', 'string')
               ->addColumn('data', 'text')
               ->addIndex(['kinopoisk_id'])
               ->save();

        $sessions = $this->table("sessions", ['id' => true, 'primary_key' => 'id']);
        $sessions->addColumn('movie_id', 'integer')
                ->addColumn('time', 'datetime')
                ->addIndex(['movie_id'])
                ->save();
    }
}
