Your IP : 3.22.75.92


Current Path : /var/www/u0635749/data/www/hobbyclick.ru/
Upload File :
Current File : /var/www/u0635749/data/www/hobbyclick.ru/migrator

#!/usr/bin/env php
<?php

use Arrilot\BitrixMigrations\Commands\ArchiveCommand;
use Arrilot\BitrixMigrations\Commands\MakeCommand;
use Arrilot\BitrixMigrations\Commands\InstallCommand;
use Arrilot\BitrixMigrations\Commands\MigrateCommand;
use Arrilot\BitrixMigrations\Commands\RollbackCommand;
use Arrilot\BitrixMigrations\Commands\TemplatesCommand;
use Arrilot\BitrixMigrations\Commands\StatusCommand;
use Arrilot\BitrixMigrations\Constructors\IBlock;
use Arrilot\BitrixMigrations\Migrator;
use Arrilot\BitrixMigrations\Storages\BitrixDatabaseStorage;
use Arrilot\BitrixMigrations\TemplatesCollection;
use Symfony\Component\Console\Application;

define("NOT_CHECK_PERMISSIONS", true);
$_SERVER["DOCUMENT_ROOT"] = __DIR__."/public";
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
require $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php";

CModule::IncludeModule("iblock");

$config = [
    'table' => 'migrations',
    'dir' => './migrations',
    // 'dir_archive' => 'archive', // not required. default = "archive"
    'use_transaction' => true, // not required. default = false
    'default_fields' => [
        IBlock::class => [
            'INDEX_ELEMENT' => 'N',
            'INDEX_SECTION' => 'N',
            'VERSION' => 2,
            'SITE_ID' => 's1',
        ]
    ]
];

$database = new BitrixDatabaseStorage($config['table']);
$templates = new TemplatesCollection();
$templates->registerBasicTemplates();

$migrator = new Migrator($config, $templates, $database);

$app = new Application('Migrator');
$app->add(new MakeCommand($migrator));
$app->add(new InstallCommand($config['table'], $database));
$app->add(new MigrateCommand($migrator));
$app->add(new RollbackCommand($migrator));
$app->add(new TemplatesCommand($templates));
$app->add(new StatusCommand($migrator));
$app->add(new ArchiveCommand($migrator));
$app->run();