<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230726131551 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE `oscpv_calculations` (id INT AUTO_INCREMENT NOT NULL, client_id INT DEFAULT NULL, status_id VARCHAR(150) DEFAULT NULL, car_id INT NOT NULL, car_brand_id INT NOT NULL, car_model_id INT NOT NULL, car_type_id INT NOT NULL, city_id INT NOT NULL, privilege_id INT DEFAULT NULL, franchise_id INT DEFAULT NULL, voluntary_insurance_id INT DEFAULT NULL, source_id INT DEFAULT NULL, external_code VARCHAR(255) DEFAULT NULL, car_number VARCHAR(50) NOT NULL, date_production INT NOT NULL, car_vin VARCHAR(150) DEFAULT NULL, is_taxi TINYINT(1) NOT NULL, promo_code VARCHAR(150) DEFAULT NULL, price_uah DOUBLE PRECISION DEFAULT NULL, vi_price_uah DOUBLE PRECISION DEFAULT NULL, calculation LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_5B2B10DDE20A50B4 (external_code), INDEX IDX_5B2B10DD19EB6921 (client_id), INDEX IDX_5B2B10DD6BF700BD (status_id), INDEX IDX_5B2B10DDC3C6F69F (car_id), INDEX IDX_5B2B10DDCBC3E50C (car_brand_id), INDEX IDX_5B2B10DDF64382E3 (car_model_id), INDEX IDX_5B2B10DD96E7774F (car_type_id), INDEX IDX_5B2B10DD8BAC62AF (city_id), INDEX IDX_5B2B10DD32FB8AEA (privilege_id), INDEX IDX_5B2B10DD523CAB89 (franchise_id), INDEX IDX_5B2B10DDB4ED06E9 (voluntary_insurance_id), INDEX IDX_5B2B10DD953C1C61 (source_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `oscpv_list_franchises` (id INT AUTO_INCREMENT NOT NULL, external_code VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, sum_uah INT NOT NULL, sorting INT DEFAULT 500 NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_47FFEDAEE20A50B4 (external_code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DD19EB6921 FOREIGN KEY (client_id) REFERENCES `crm_clients` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DD6BF700BD FOREIGN KEY (status_id) REFERENCES `list_statuses` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DDC3C6F69F FOREIGN KEY (car_id) REFERENCES `crm_cars` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DDCBC3E50C FOREIGN KEY (car_brand_id) REFERENCES `oscpv_list_car_brands` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DDF64382E3 FOREIGN KEY (car_model_id) REFERENCES `oscpv_list_car_models` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DD96E7774F FOREIGN KEY (car_type_id) REFERENCES `oscpv_list_car_types` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DD8BAC62AF FOREIGN KEY (city_id) REFERENCES `oscpv_list_cities` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DD32FB8AEA FOREIGN KEY (privilege_id) REFERENCES `oscpv_list_privileges` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DD523CAB89 FOREIGN KEY (franchise_id) REFERENCES `oscpv_list_franchises` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DDB4ED06E9 FOREIGN KEY (voluntary_insurance_id) REFERENCES `oscpv_list_voluntary_insurance` (id)');
$this->addSql('ALTER TABLE `oscpv_calculations` ADD CONSTRAINT FK_5B2B10DD953C1C61 FOREIGN KEY (source_id) REFERENCES `list_sources` (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DD19EB6921');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DD6BF700BD');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DDC3C6F69F');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DDCBC3E50C');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DDF64382E3');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DD96E7774F');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DD8BAC62AF');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DD32FB8AEA');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DD523CAB89');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DDB4ED06E9');
$this->addSql('ALTER TABLE `oscpv_calculations` DROP FOREIGN KEY FK_5B2B10DD953C1C61');
$this->addSql('DROP TABLE `oscpv_calculations`');
$this->addSql('DROP TABLE `oscpv_list_franchises`');
}
}