<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20211020085719 extends AbstractMigration
{
public function getDescription(): string
{
return 'All initial version DB';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE address_config (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, habitation_type_id INT DEFAULT NULL, longitude DOUBLE PRECISION DEFAULT NULL, latitude DOUBLE PRECISION DEFAULT NULL, outdoor TINYINT(1) NOT NULL, transport_access TINYINT(1) NOT NULL, parking_close TINYINT(1) NOT NULL, house_nb VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, country VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_EFD3AAC3A76ED395 (user_id), INDEX IDX_EFD3AAC3A57755CB (habitation_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cat (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, profile_photo_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, age_years INT NOT NULL, age_months INT NOT NULL, description VARCHAR(255) DEFAULT NULL, chipped TINYINT(1) DEFAULT NULL, sterilized TINYINT(1) NOT NULL, friendly_with_children TINYINT(1) DEFAULT NULL, friendly_with_other_animals TINYINT(1) DEFAULT NULL, energy_level INT NOT NULL, allowed_go_out TINYINT(1) NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_9E5E43A87E3C61F9 (owner_id), UNIQUE INDEX UNIQ_9E5E43A887F42D3D (profile_photo_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE donate_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE habitation_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE photo (id INT AUTO_INCREMENT NOT NULL, sitter_config_id INT DEFAULT NULL, cat_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, uri VARCHAR(255) DEFAULT NULL, INDEX IDX_14B784183BA50BBC (sitter_config_id), INDEX IDX_14B78418E6ADA943 (cat_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE refresh_tokens (id INT AUTO_INCREMENT NOT NULL, refresh_token VARCHAR(128) NOT NULL, username VARCHAR(255) NOT NULL, valid DATETIME NOT NULL, UNIQUE INDEX UNIQ_9BACE7E1C74F2195 (refresh_token), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE search_match (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, sitter_id INT NOT NULL, search_owner_id INT NOT NULL, search_sitter_id INT DEFAULT NULL, match_type INT NOT NULL, direction_type INT NOT NULL, status VARCHAR(255) NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL, email_dont_forget_to_accept_at DATE DEFAULT NULL, email_dont_forget_to_pay_at DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_4E6E06EC7E3C61F9 (owner_id), INDEX IDX_4E6E06EC61F367C9 (sitter_id), INDEX IDX_4E6E06EC6E6BCA4C (search_owner_id), INDEX IDX_4E6E06ECDAE87761 (search_sitter_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE search_owner (id INT AUTO_INCREMENT NOT NULL, cat_id INT DEFAULT NULL, search_owner_user_id INT NOT NULL, address VARCHAR(255) NOT NULL, longitude DOUBLE PRECISION NOT NULL, latitude DOUBLE PRECISION NOT NULL, public TINYINT(1) NOT NULL, visit_service TINYINT(1) NOT NULL, hosting_service TINYINT(1) NOT NULL, start_date DATE DEFAULT NULL, end_date DATE DEFAULT NULL, owner_bring_cat TINYINT(1) NOT NULL, flexible_dates TINYINT(1) NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_FB552595E6ADA943 (cat_id), INDEX IDX_FB5525954A64664E (search_owner_user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE search_sitter (id INT AUTO_INCREMENT NOT NULL, search_sitter_user_id INT NOT NULL, address VARCHAR(255) NOT NULL, longitude DOUBLE PRECISION NOT NULL, latitude DOUBLE PRECISION NOT NULL, visit_service TINYINT(1) NOT NULL, hosting_service TINYINT(1) NOT NULL, start_date DATE DEFAULT NULL, end_date DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_6090DC5AFFF7D5D9 (search_sitter_user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sitter_config (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, donate_type_id INT DEFAULT NULL, host_habitation_type_id INT DEFAULT NULL, visit_service TINYINT(1) NOT NULL, hosting_service TINYINT(1) NOT NULL, description VARCHAR(4000) DEFAULT NULL, host_outdoor TINYINT(1) NOT NULL, host_high_floor TINYINT(1) NOT NULL, host_day_at_home TINYINT(1) NOT NULL, host_children_at_home TINYINT(1) NOT NULL, host_animal_at_home TINYINT(1) NOT NULL, host_smoking_at_home TINYINT(1) NOT NULL, host_max_cat_nb INT NOT NULL, host_max_hold_days_nb INT NOT NULL, host_withdraw_cat TINYINT(1) NOT NULL, host_volunteer TINYINT(1) NOT NULL, host_price_day_cat INT NOT NULL, host_minutes_spend_with_cat_day INT NOT NULL, visit_minutes_spend_with_cat_day INT NOT NULL, visit_max_cat_nb INT NOT NULL, visit_max_days_nb INT NOT NULL, visit_volunteer TINYINT(1) NOT NULL, visit_pour_flowers TINYINT(1) NOT NULL, visit_price_day_cat INT NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_44BC4145A76ED395 (user_id), INDEX IDX_44BC4145D3FE (donate_type_id), INDEX IDX_44BC4145E63848A3 (host_habitation_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sitter_unavailability (id INT AUTO_INCREMENT NOT NULL, sitter_id INT NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_4D2EAA9F61F367C9 (sitter_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, profile_photo_id INT DEFAULT NULL, email VARCHAR(180) NOT NULL, active TINYINT(1) DEFAULT \'0\', roles JSON NOT NULL, password VARCHAR(255) NOT NULL, first_name VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, deleted TINYINT(1) DEFAULT \'0\', activation_token VARCHAR(255) DEFAULT NULL, forget_password_token VARCHAR(255) DEFAULT NULL, address VARCHAR(255) DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, birthday DATETIME DEFAULT NULL, accepted_terms_and_conditions TINYINT(1) NOT NULL, accepted_terms_and_conditions_at DATE DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), UNIQUE INDEX UNIQ_8D93D64987F42D3D (profile_photo_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE address_config ADD CONSTRAINT FK_EFD3AAC3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE address_config ADD CONSTRAINT FK_EFD3AAC3A57755CB FOREIGN KEY (habitation_type_id) REFERENCES habitation_type (id)');
$this->addSql('ALTER TABLE cat ADD CONSTRAINT FK_9E5E43A87E3C61F9 FOREIGN KEY (owner_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE cat ADD CONSTRAINT FK_9E5E43A887F42D3D FOREIGN KEY (profile_photo_id) REFERENCES photo (id)');
$this->addSql('ALTER TABLE photo ADD CONSTRAINT FK_14B784183BA50BBC FOREIGN KEY (sitter_config_id) REFERENCES sitter_config (id)');
$this->addSql('ALTER TABLE photo ADD CONSTRAINT FK_14B78418E6ADA943 FOREIGN KEY (cat_id) REFERENCES cat (id)');
$this->addSql('ALTER TABLE search_match ADD CONSTRAINT FK_4E6E06EC7E3C61F9 FOREIGN KEY (owner_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE search_match ADD CONSTRAINT FK_4E6E06EC61F367C9 FOREIGN KEY (sitter_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE search_match ADD CONSTRAINT FK_4E6E06EC6E6BCA4C FOREIGN KEY (search_owner_id) REFERENCES search_owner (id)');
$this->addSql('ALTER TABLE search_match ADD CONSTRAINT FK_4E6E06ECDAE87761 FOREIGN KEY (search_sitter_id) REFERENCES search_sitter (id)');
$this->addSql('ALTER TABLE search_owner ADD CONSTRAINT FK_FB552595E6ADA943 FOREIGN KEY (cat_id) REFERENCES cat (id)');
$this->addSql('ALTER TABLE search_owner ADD CONSTRAINT FK_FB5525954A64664E FOREIGN KEY (search_owner_user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE search_sitter ADD CONSTRAINT FK_6090DC5AFFF7D5D9 FOREIGN KEY (search_sitter_user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sitter_config ADD CONSTRAINT FK_44BC4145A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sitter_config ADD CONSTRAINT FK_44BC4145D3FE FOREIGN KEY (donate_type_id) REFERENCES donate_type (id)');
$this->addSql('ALTER TABLE sitter_config ADD CONSTRAINT FK_44BC4145E63848A3 FOREIGN KEY (host_habitation_type_id) REFERENCES habitation_type (id)');
$this->addSql('ALTER TABLE sitter_unavailability ADD CONSTRAINT FK_4D2EAA9F61F367C9 FOREIGN KEY (sitter_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D64987F42D3D FOREIGN KEY (profile_photo_id) REFERENCES photo (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE photo DROP FOREIGN KEY FK_14B78418E6ADA943');
$this->addSql('ALTER TABLE search_owner DROP FOREIGN KEY FK_FB552595E6ADA943');
$this->addSql('ALTER TABLE sitter_config DROP FOREIGN KEY FK_44BC4145D3FE');
$this->addSql('ALTER TABLE address_config DROP FOREIGN KEY FK_EFD3AAC3A57755CB');
$this->addSql('ALTER TABLE sitter_config DROP FOREIGN KEY FK_44BC4145E63848A3');
$this->addSql('ALTER TABLE cat DROP FOREIGN KEY FK_9E5E43A887F42D3D');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D64987F42D3D');
$this->addSql('ALTER TABLE search_match DROP FOREIGN KEY FK_4E6E06EC6E6BCA4C');
$this->addSql('ALTER TABLE search_match DROP FOREIGN KEY FK_4E6E06ECDAE87761');
$this->addSql('ALTER TABLE photo DROP FOREIGN KEY FK_14B784183BA50BBC');
$this->addSql('ALTER TABLE address_config DROP FOREIGN KEY FK_EFD3AAC3A76ED395');
$this->addSql('ALTER TABLE cat DROP FOREIGN KEY FK_9E5E43A87E3C61F9');
$this->addSql('ALTER TABLE search_match DROP FOREIGN KEY FK_4E6E06EC7E3C61F9');
$this->addSql('ALTER TABLE search_match DROP FOREIGN KEY FK_4E6E06EC61F367C9');
$this->addSql('ALTER TABLE search_owner DROP FOREIGN KEY FK_FB5525954A64664E');
$this->addSql('ALTER TABLE search_sitter DROP FOREIGN KEY FK_6090DC5AFFF7D5D9');
$this->addSql('ALTER TABLE sitter_config DROP FOREIGN KEY FK_44BC4145A76ED395');
$this->addSql('ALTER TABLE sitter_unavailability DROP FOREIGN KEY FK_4D2EAA9F61F367C9');
$this->addSql('DROP TABLE address_config');
$this->addSql('DROP TABLE cat');
$this->addSql('DROP TABLE donate_type');
$this->addSql('DROP TABLE habitation_type');
$this->addSql('DROP TABLE photo');
$this->addSql('DROP TABLE refresh_tokens');
$this->addSql('DROP TABLE search_match');
$this->addSql('DROP TABLE search_owner');
$this->addSql('DROP TABLE search_sitter');
$this->addSql('DROP TABLE sitter_config');
$this->addSql('DROP TABLE sitter_unavailability');
$this->addSql('DROP TABLE user');
}
public function isTransactional(): bool
{
return false;
}
}