migrations/Version20220919055732.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220919055732 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE "users_analytics" (id INT NOT NULL, invoice_period_id INT NOT NULL, user_id INT NOT NULL, user_invoice_period_id INT NOT NULL, solve_problems TEXT DEFAULT NULL, call_analysis TEXT DEFAULT NULL, final_characteristic TEXT DEFAULT NULL, customer_focus INT DEFAULT 0 NOT NULL, informal_communication INT DEFAULT 0 NOT NULL, decision_speed INT DEFAULT 0 NOT NULL, material_knowledge INT DEFAULT 0 NOT NULL, job_title VARCHAR(255) DEFAULT NULL, additional_work VARCHAR(255) DEFAULT NULL, published BOOLEAN DEFAULT \'false\' NOT NULL, PRIMARY KEY(id))');
  19.         $this->addSql('CREATE INDEX IDX_8CBF9C6989248B42 ON "users_analytics" (invoice_period_id)');
  20.         $this->addSql('CREATE INDEX IDX_8CBF9C69A76ED395 ON "users_analytics" (user_id)');
  21.         $this->addSql('CREATE UNIQUE INDEX UNIQ_8CBF9C69713B3069 ON "users_analytics" (user_invoice_period_id)');
  22.         $this->addSql('ALTER TABLE "users_analytics" ADD CONSTRAINT FK_8CBF9C6989248B42 FOREIGN KEY (invoice_period_id) REFERENCES "invoices_periods" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  23.         $this->addSql('ALTER TABLE "users_analytics" ADD CONSTRAINT FK_8CBF9C69A76ED395 FOREIGN KEY (user_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  24.         $this->addSql('ALTER TABLE "users_analytics" ADD CONSTRAINT FK_8CBF9C69713B3069 FOREIGN KEY (user_invoice_period_id) REFERENCES "users_invoices_periods" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  25.         $this->addSql('ALTER TABLE shifts ADD need_analytics BOOLEAN DEFAULT \'false\' NOT NULL');
  26.         $this->addSql('ALTER TABLE users ADD started_job TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL');
  27.         $this->addSql('ALTER TABLE users ADD img VARCHAR(255) DEFAULT NULL');
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->addSql('CREATE SCHEMA public');
  33.         $this->addSql('DROP TABLE "users_analytics"');
  34.         $this->addSql('ALTER TABLE "users" DROP started_job');
  35.         $this->addSql('ALTER TABLE "users" DROP img');
  36.         $this->addSql('ALTER TABLE "shifts" DROP need_analytics');
  37.     }
  38. }