<?php
require __DIR__ . '/../../vendor/autoload.php';

use Core\Database\MigrationHistory;



define('ROOT_PATH', realpath(__DIR__ . '/../../'));
define('APP_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'app');
define('CORE_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'core');
define('VENDOR_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'vendor');
define('CONFIG_PATH', APP_PATH . DIRECTORY_SEPARATOR . 'config');
define('STORAGE_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'storage');

print_r(MigrationHistory::loadAll());

// // Your test code goes here
// $record = [
//     'id' => uniqid(),
//     'migration_name' => 'create_users_table',
//     'operation_class' => 'CreateTable::class',
//     'operation_data' => [
//         'table' => 'users',
//         'columns' => ['id'=>'INT PRIMARY KEY', 'name'=>'VARCHAR(255)']
//     ],
//     'executed_at' => time()
// ];

// $history = file_exists(STORAGE_PATH . DIRECTORY_SEPARATOR .'migrations.bin') 
//     ? unserialize(gzuncompress(file_get_contents(STORAGE_PATH . DIRECTORY_SEPARATOR .'migrations.bin')))
//     : [];

// $history[] = $record;

// file_put_contents(STORAGE_PATH . DIRECTORY_SEPARATOR .'migrations.bin', gzcompress(serialize($history)));
