<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220518165600 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE address (id INT AUTO_INCREMENT NOT NULL, visiting_card_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, post_code VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, street_number VARCHAR(255) DEFAULT NULL, street_local VARCHAR(255) DEFAULT NULL, custom_field LONGTEXT DEFAULT NULL, custom_field_name VARCHAR(255) DEFAULT NULL, INDEX IDX_D4E6F81EB37EBA0 (visiting_card_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE assosiated_sites (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, icon VARCHAR(255) DEFAULT NULL, short_description VARCHAR(255) DEFAULT NULL, long_description LONGTEXT DEFAULT NULL, hint VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE button (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, sub_category_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, search_engine INT DEFAULT NULL, INDEX IDX_3A06AC3D12469DE2 (category_id), INDEX IDX_3A06AC3DF7BFE87C (sub_category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, search_engine INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE flag (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, icon VARCHAR(255) DEFAULT NULL, is_active TINYINT(1) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE link (id INT AUTO_INCREMENT NOT NULL, visiting_card_id INT DEFAULT NULL, name LONGTEXT DEFAULT NULL, INDEX IDX_36AC99F1EB37EBA0 (visiting_card_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE menu (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE open_hours (id INT AUTO_INCREMENT NOT NULL, visiting_card_id INT DEFAULT NULL, day_number INT DEFAULT NULL, open_at INT DEFAULT NULL, close_at INT DEFAULT NULL, INDEX IDX_C1A79D8BEB37EBA0 (visiting_card_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE owner_info (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, short_description VARCHAR(255) DEFAULT NULL, long_description LONGTEXT DEFAULT NULL, assosiated_site_name VARCHAR(255) DEFAULT NULL, logo VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE phones (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, is_active TINYINT(1) NOT NULL, phone_order INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sub_category (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, search_engine INT DEFAULT NULL, INDEX IDX_BCE3F79812469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tag (id INT AUTO_INCREMENT NOT NULL, visiting_card_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, icon VARCHAR(255) DEFAULT NULL, is_active TINYINT(1) DEFAULT NULL, INDEX IDX_389B783EB37EBA0 (visiting_card_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_permission_roles (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(191) DEFAULT NULL COMMENT \'nazwa\', code VARCHAR(191) DEFAULT NULL COMMENT \'kod\', created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, INDEX user_permission_roles_code_index (code), INDEX user_permission_roles_name_index (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE users (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, role_id BIGINT UNSIGNED DEFAULT NULL, name VARCHAR(191) NOT NULL, code VARCHAR(191) DEFAULT NULL, firstname VARCHAR(191) DEFAULT NULL, lastname VARCHAR(191) DEFAULT NULL, initials VARCHAR(191) DEFAULT NULL, phone VARCHAR(191) DEFAULT NULL, email VARCHAR(191) NOT NULL, email_verified_at DATETIME DEFAULT NULL, password VARCHAR(191) NOT NULL, remember_token VARCHAR(100) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_1483A5E9D60322AC (role_id), UNIQUE INDEX users_code_unique (code), UNIQUE INDEX users_email_unique (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE visiting_card (id INT AUTO_INCREMENT NOT NULL, category_id INT DEFAULT NULL, sub_category_id INT DEFAULT NULL, button_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, short_description VARCHAR(255) DEFAULT NULL, long_description LONGTEXT DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, position INT DEFAULT NULL, time_trigger TINYINT(1) DEFAULT NULL, lattitude VARCHAR(255) DEFAULT NULL, longtitude VARCHAR(255) DEFAULT NULL, INDEX IDX_CB2C96CC12469DE2 (category_id), INDEX IDX_CB2C96CCF7BFE87C (sub_category_id), INDEX IDX_CB2C96CCA123E519 (button_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE address ADD CONSTRAINT FK_D4E6F81EB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
$this->addSql('ALTER TABLE button ADD CONSTRAINT FK_3A06AC3D12469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
$this->addSql('ALTER TABLE button ADD CONSTRAINT FK_3A06AC3DF7BFE87C FOREIGN KEY (sub_category_id) REFERENCES sub_category (id)');
$this->addSql('ALTER TABLE link ADD CONSTRAINT FK_36AC99F1EB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
$this->addSql('ALTER TABLE open_hours ADD CONSTRAINT FK_C1A79D8BEB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
$this->addSql('ALTER TABLE sub_category ADD CONSTRAINT FK_BCE3F79812469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
$this->addSql('ALTER TABLE tag ADD CONSTRAINT FK_389B783EB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
$this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E9D60322AC FOREIGN KEY (role_id) REFERENCES user_permission_roles (id)');
$this->addSql('ALTER TABLE visiting_card ADD CONSTRAINT FK_CB2C96CC12469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
$this->addSql('ALTER TABLE visiting_card ADD CONSTRAINT FK_CB2C96CCF7BFE87C FOREIGN KEY (sub_category_id) REFERENCES sub_category (id)');
$this->addSql('ALTER TABLE visiting_card ADD CONSTRAINT FK_CB2C96CCA123E519 FOREIGN KEY (button_id) REFERENCES button (id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE visiting_card DROP FOREIGN KEY FK_CB2C96CCA123E519');
$this->addSql('ALTER TABLE button DROP FOREIGN KEY FK_3A06AC3D12469DE2');
$this->addSql('ALTER TABLE sub_category DROP FOREIGN KEY FK_BCE3F79812469DE2');
$this->addSql('ALTER TABLE visiting_card DROP FOREIGN KEY FK_CB2C96CC12469DE2');
$this->addSql('ALTER TABLE button DROP FOREIGN KEY FK_3A06AC3DF7BFE87C');
$this->addSql('ALTER TABLE visiting_card DROP FOREIGN KEY FK_CB2C96CCF7BFE87C');
$this->addSql('ALTER TABLE users DROP FOREIGN KEY FK_1483A5E9D60322AC');
$this->addSql('ALTER TABLE address DROP FOREIGN KEY FK_D4E6F81EB37EBA0');
$this->addSql('ALTER TABLE link DROP FOREIGN KEY FK_36AC99F1EB37EBA0');
$this->addSql('ALTER TABLE open_hours DROP FOREIGN KEY FK_C1A79D8BEB37EBA0');
$this->addSql('ALTER TABLE tag DROP FOREIGN KEY FK_389B783EB37EBA0');
$this->addSql('DROP TABLE address');
$this->addSql('DROP TABLE assosiated_sites');
$this->addSql('DROP TABLE button');
$this->addSql('DROP TABLE category');
$this->addSql('DROP TABLE flag');
$this->addSql('DROP TABLE link');
$this->addSql('DROP TABLE menu');
$this->addSql('DROP TABLE open_hours');
$this->addSql('DROP TABLE owner_info');
$this->addSql('DROP TABLE phones');
$this->addSql('DROP TABLE sub_category');
$this->addSql('DROP TABLE tag');
$this->addSql('DROP TABLE user_permission_roles');
$this->addSql('DROP TABLE users');
$this->addSql('DROP TABLE visiting_card');
$this->addSql('DROP TABLE messenger_messages');
}
}