composer require arrilot/bitrix-migrations php migrator install php migrator make migration_name <?php
use Arrilot\BitrixMigrations\BaseMigrations\BitrixMigration;
use Arrilot\BitrixMigrations\Exceptions\MigrationException;
class TestMigration20230721161152182831 extends BitrixMigration
{
   /**
    * Run the migration.
    *
    * @return mixed
    * @throws \Exception
    */
   public function up()
   {
       //
   }
   /**
    * Reverse the migration.
    *
    * @return mixed
    * @throws \Exception
    */
   public function down()
   {
       //
   }
} php migrator status php migrator migrate php migrator rollback php migrator make new_ib_test -t add_iblock <?php
use Arrilot\BitrixMigrations\BaseMigrations\BitrixMigration;
use Arrilot\BitrixMigrations\Exceptions\MigrationException;
class NewIbTest20230721163328531029 extends BitrixMigration
{
   public function up()
   {
       $ib = new CIBlock;
       $iblockId = $ib->add([
           'NAME' => '__',
           'CODE' => '__',
           'SITE_ID' => 's1',
           'IBLOCK_TYPE_ID' => '__', //символьный код группы инфоблока,
           'VERSION' => 2,
           'GROUP_ID' => ['2' =>'R'],
           'LIST_PAGE_URL' => '__',
           'DETAIL_PAGE_URL' => '__',
       ]);
       if (!$iblockId) {
           throw new MigrationException('Ошибка при добавлении инфоблока '.$ib->LAST_ERROR);
       }
       // свойства
       $propId = $this->addIblockElementProperty([
           'NAME' => '__',
           'SORT' => 500,
           'CODE' => '',
           'PROPERTY_TYPE' => 'L', // Список
           'LIST_TYPE' => 'C', // Тип списка - 'флажки'
           'VALUES' => [
               'VALUE' => 'да',
           ],
           'MULTIPLE'  => 'N',
           'IS_REQUIRED' => 'N',
           'IBLOCK_ID' => $iblockId
       ]);
   }
   public function down()
   {
       $this->deleteIblockByCode('__');
   }
} 
 php migrator templates