<?php

class Migration_20240712000021_update_dealer_slots_tbl
{
    public static function up(PDO $pdo)
    {
        $sql = "
            DROP TABLE IF EXISTS `dealer_slots`
        ";

        $pdo->exec($sql);

        $sql1 = "
            CREATE TABLE IF NOT EXISTS `dealer_slots` (
                `dealer_id` INT NOT NULL AUTO_INCREMENT,
                `slots_avail` INT NOT NULL,
                `slots_used` INT NOT NULL,
                PRIMARY KEY (`dealer_id`)
            )
        ";

        $pdo->exec($sql1);

        $sql2 = "
            INSERT INTO dealer_slots (dealer_id, slots_avail, slots_used) VALUES 
            (3, 10, 1)
        ";

        $pdo->exec($sql2);
    }

    public static function down(PDO $pdo)
    {
        $sql = "
            DROP TABLE IF EXISTS `dealer_slots`
        ";

        $pdo->exec($sql);
    }
}
