cmtracker/migrations/Version20241203041202.php
2024-12-02 23:13:08 -05:00

82 lines
11 KiB
PHP

<?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 Version20241203041202 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 case_location (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', origin_location_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', dest_location_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', date DATE NOT NULL, departure TIME DEFAULT NULL, arrival TIME DEFAULT NULL, case_mileage TINYINT(1) NOT NULL, INDEX IDX_C9E3F3B6E99C7F9 (origin_location_id), INDEX IDX_C9E3F3B6BF14A4AE (dest_location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE case_note (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', case_id_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', report_id_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', note_type VARCHAR(255) NOT NULL, file VARCHAR(255) DEFAULT NULL, INDEX IDX_4EA520A72DAD64BB (case_id_id), INDEX IDX_4EA520A75558992E (report_id_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE company (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', owner_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) NOT NULL, address VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, state VARCHAR(10) NOT NULL, zip VARCHAR(15) NOT NULL, phone VARCHAR(15) NOT NULL, email VARCHAR(64) NOT NULL, url VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_4FBF094F7E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE location (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(45) NOT NULL, address VARCHAR(255) NOT NULL, cases LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', lat NUMERIC(10, 6) DEFAULT NULL, lon NUMERIC(10, 6) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE location_options (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(45) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `member` (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', case_id_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', last_name VARCHAR(45) NOT NULL, first_name VARCHAR(45) NOT NULL, relationship VARCHAR(45) DEFAULT NULL, personal_id VARCHAR(45) DEFAULT NULL, gender VARCHAR(255) DEFAULT NULL, race VARCHAR(45) DEFAULT NULL, dob DATE NOT NULL, language VARCHAR(45) DEFAULT NULL, emergency_contact VARCHAR(45) DEFAULT NULL, phone VARCHAR(15) DEFAULT NULL, day_phone VARCHAR(15) DEFAULT NULL, evening_phone VARCHAR(15) DEFAULT NULL, cell_phone VARCHAR(15) DEFAULT NULL, email VARCHAR(45) DEFAULT NULL, school VARCHAR(255) DEFAULT NULL, address VARCHAR(64) DEFAULT NULL, city VARCHAR(45) DEFAULT NULL, state VARCHAR(15) DEFAULT NULL, zip VARCHAR(10) DEFAULT NULL, marital_status VARCHAR(45) DEFAULT NULL, is_child TINYINT(1) NOT NULL, is_parent TINYINT(1) NOT NULL, is_adult_child TINYINT(1) NOT NULL, is_legal_guardian TINYINT(1) NOT NULL, parents_live_together TINYINT(1) NOT NULL, INDEX IDX_70E4FA782DAD64BB (case_id_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE member_case (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', case_number VARCHAR(15) NOT NULL, hours DOUBLE PRECISION NOT NULL, end_date DATE NOT NULL, case_name VARCHAR(64) NOT NULL, service VARCHAR(45) NOT NULL, referral_number VARCHAR(45) NOT NULL, first_name VARCHAR(45) NOT NULL, last_name VARCHAR(45) NOT NULL, referral_type VARCHAR(45) NOT NULL, referral_source VARCHAR(45) NOT NULL, referral_source2 VARCHAR(45) DEFAULT NULL, admit_date DATE DEFAULT NULL, close_date DATE DEFAULT NULL, dcs_case_id VARCHAR(45) DEFAULT NULL, insurance VARCHAR(45) DEFAULT NULL, medicaid VARCHAR(45) DEFAULT NULL, fcm_email VARCHAR(64) DEFAULT NULL, case_email VARCHAR(45) DEFAULT NULL, address VARCHAR(64) DEFAULT NULL, city VARCHAR(45) DEFAULT NULL, state VARCHAR(15) DEFAULT NULL, zip VARCHAR(10) DEFAULT NULL, country VARCHAR(45) DEFAULT NULL, level VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE method_options (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(45) NOT NULL, rel VARCHAR(45) NOT NULL, idx INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE report (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', location_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', method_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', type VARCHAR(45) NOT NULL, start_time TIME NOT NULL, end_time TIME NOT NULL, case_number VARCHAR(45) NOT NULL, others_present JSON NOT NULL, note JSON NOT NULL, INDEX IDX_C42F778464D218E (location_id), INDEX IDX_C42F778419883967 (method_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE supervision (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', supervisor_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', worker_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_30C258C019E9AC5F (supervisor_id), UNIQUE INDEX UNIQ_30C258C06B20BA36 (worker_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', company_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', username VARCHAR(45) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, name VARCHAR(45) NOT NULL, email VARCHAR(45) NOT NULL, rate_type VARCHAR(255) NOT NULL, rate NUMERIC(6, 2) NOT NULL, level VARCHAR(255) NOT NULL, case_worker TINYINT(1) NOT NULL, case_manager TINYINT(1) NOT NULL, therapist TINYINT(1) NOT NULL, su TINYINT(1) NOT NULL, INDEX IDX_8D93D649979B1AD6 (company_id), UNIQUE INDEX UNIQ_IDENTIFIER_USERNAME (username), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_case (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', user_id_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', case_id_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_289D5CD9D86650F (user_id_id), INDEX IDX_289D5CD2DAD64BB (case_id_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 COMMENT \'(DC2Type:datetime_immutable)\', available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', 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 case_location ADD CONSTRAINT FK_C9E3F3B6E99C7F9 FOREIGN KEY (origin_location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE case_location ADD CONSTRAINT FK_C9E3F3B6BF14A4AE FOREIGN KEY (dest_location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE case_note ADD CONSTRAINT FK_4EA520A72DAD64BB FOREIGN KEY (case_id_id) REFERENCES member_case (id)');
$this->addSql('ALTER TABLE case_note ADD CONSTRAINT FK_4EA520A75558992E FOREIGN KEY (report_id_id) REFERENCES report (id)');
$this->addSql('ALTER TABLE company ADD CONSTRAINT FK_4FBF094F7E3C61F9 FOREIGN KEY (owner_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE `member` ADD CONSTRAINT FK_70E4FA782DAD64BB FOREIGN KEY (case_id_id) REFERENCES member_case (id)');
$this->addSql('ALTER TABLE report ADD CONSTRAINT FK_C42F778464D218E FOREIGN KEY (location_id) REFERENCES location_options (id)');
$this->addSql('ALTER TABLE report ADD CONSTRAINT FK_C42F778419883967 FOREIGN KEY (method_id) REFERENCES method_options (id)');
$this->addSql('ALTER TABLE supervision ADD CONSTRAINT FK_30C258C019E9AC5F FOREIGN KEY (supervisor_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE supervision ADD CONSTRAINT FK_30C258C06B20BA36 FOREIGN KEY (worker_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE user_case ADD CONSTRAINT FK_289D5CD9D86650F FOREIGN KEY (user_id_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user_case ADD CONSTRAINT FK_289D5CD2DAD64BB FOREIGN KEY (case_id_id) REFERENCES member_case (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE case_location DROP FOREIGN KEY FK_C9E3F3B6E99C7F9');
$this->addSql('ALTER TABLE case_location DROP FOREIGN KEY FK_C9E3F3B6BF14A4AE');
$this->addSql('ALTER TABLE case_note DROP FOREIGN KEY FK_4EA520A72DAD64BB');
$this->addSql('ALTER TABLE case_note DROP FOREIGN KEY FK_4EA520A75558992E');
$this->addSql('ALTER TABLE company DROP FOREIGN KEY FK_4FBF094F7E3C61F9');
$this->addSql('ALTER TABLE `member` DROP FOREIGN KEY FK_70E4FA782DAD64BB');
$this->addSql('ALTER TABLE report DROP FOREIGN KEY FK_C42F778464D218E');
$this->addSql('ALTER TABLE report DROP FOREIGN KEY FK_C42F778419883967');
$this->addSql('ALTER TABLE supervision DROP FOREIGN KEY FK_30C258C019E9AC5F');
$this->addSql('ALTER TABLE supervision DROP FOREIGN KEY FK_30C258C06B20BA36');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649979B1AD6');
$this->addSql('ALTER TABLE user_case DROP FOREIGN KEY FK_289D5CD9D86650F');
$this->addSql('ALTER TABLE user_case DROP FOREIGN KEY FK_289D5CD2DAD64BB');
$this->addSql('DROP TABLE case_location');
$this->addSql('DROP TABLE case_note');
$this->addSql('DROP TABLE company');
$this->addSql('DROP TABLE location');
$this->addSql('DROP TABLE location_options');
$this->addSql('DROP TABLE `member`');
$this->addSql('DROP TABLE member_case');
$this->addSql('DROP TABLE method_options');
$this->addSql('DROP TABLE report');
$this->addSql('DROP TABLE supervision');
$this->addSql('DROP TABLE user');
$this->addSql('DROP TABLE user_case');
$this->addSql('DROP TABLE messenger_messages');
}
}