migrations/Version20210609074853.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 Version20210609074853 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('ALTER TABLE registrations ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE students ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE pck_charges (id INT AUTO_INCREMENT NOT NULL, transaction_id INT NOT NULL, student_id INT NOT NULL, cc_last4 INT NOT NULL, charge_date DATETIME NOT NULL, charge_amount INT NOT NULL, auth_net_trans_id INT DEFAULT NULL, auth_net_result VARCHAR(255) DEFAULT NULL, auth_net_result_code VARCHAR(45) DEFAULT NULL, refund_date DATETIME DEFAULT NULL, refund_amount INT DEFAULT NULL, refund_auth_net_trans_id INT DEFAULT NULL, refund_auth_net_result VARCHAR(255) DEFAULT NULL, refund_auth_net_result_code VARCHAR(45) DEFAULT NULL, reason_code VARCHAR(45) DEFAULT NULL, INDEX IDX_5AC62D1B2FC0CB0F (transaction_id), INDEX IDX_5AC62D1BCB944F1A (student_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE pck_packages (id INT AUTO_INCREMENT NOT NULL, student_id INT NOT NULL, package_types_id INT NOT NULL, active TINYINT(1) NOT NULL, credit_balance INT NOT NULL, INDEX IDX_ECD2D94CCB944F1A (student_id), INDEX IDX_ECD2D94C6A33A739 (package_types_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE pck_packagetypes (id INT AUTO_INCREMENT NOT NULL, displayName VARCHAR(45) NOT NULL, numberOfCredits SMALLINT NOT NULL, purchasePrice NUMERIC(8, 2) NOT NULL, internalComment VARCHAR(45) NULL, to_display TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('CREATE TABLE pck_transactions (id INT AUTO_INCREMENT NOT NULL, student_id INT NOT NULL, registrations_id INT DEFAULT NULL, transaction_date DATETIME NOT NULL, transaction_type VARCHAR(45) NOT NULL, credit_amount INT NOT NULL, registration_id INT DEFAULT NULL, refund_date DATETIME DEFAULT NULL, credits_voided INT DEFAULT NULL, INDEX IDX_1CFC5D75CB944F1A (student_id), INDEX IDX_1CFC5D758279080 (registrations_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  24.         $this->addSql('CREATE TABLE pck_transactions_packages (pck_transactions_id INT NOT NULL, pck_packages_id INT NOT NULL, INDEX IDX_16A877078F65F2B9 (pck_transactions_id), INDEX IDX_16A8770727E67CD6 (pck_packages_id), PRIMARY KEY(pck_transactions_id, pck_packages_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  25.         $this->addSql('ALTER TABLE pck_charges ADD CONSTRAINT FK_5AC62D1B2FC0CB0F FOREIGN KEY (transaction_id) REFERENCES pck_transactions (id)');
  26.         $this->addSql('ALTER TABLE pck_charges ADD CONSTRAINT FK_5AC62D1BCB944F1A FOREIGN KEY (student_id) REFERENCES students (id)');
  27.         $this->addSql('ALTER TABLE pck_packages ADD CONSTRAINT FK_ECD2D94CCB944F1A FOREIGN KEY (student_id) REFERENCES students (id)');
  28.         $this->addSql('ALTER TABLE pck_packages ADD CONSTRAINT FK_ECD2D94C6A33A739 FOREIGN KEY (package_types_id) REFERENCES pck_packagetypes (id)');
  29.         $this->addSql('ALTER TABLE pck_transactions ADD CONSTRAINT FK_1CFC5D75CB944F1A FOREIGN KEY (student_id) REFERENCES students (id)');
  30.         $this->addSql('ALTER TABLE pck_transactions ADD CONSTRAINT FK_1CFC5D758279080 FOREIGN KEY (registrations_id) REFERENCES registrations (id)');
  31.         $this->addSql('ALTER TABLE pck_transactions_packages ADD CONSTRAINT FK_16A877078F65F2B9 FOREIGN KEY (pck_transactions_id) REFERENCES pck_transactions (id) ON DELETE CASCADE');
  32.         $this->addSql('ALTER TABLE pck_transactions_packages ADD CONSTRAINT FK_16A8770727E67CD6 FOREIGN KEY (pck_packages_id) REFERENCES pck_packages (id) ON DELETE CASCADE');
  33.     }
  34.     public function down(Schema $schema): void
  35.     {
  36.         // this down() migration is auto-generated, please modify it to your needs
  37.         $this->addSql('ALTER TABLE pck_transactions_packages DROP FOREIGN KEY FK_16A8770727E67CD6');
  38.         $this->addSql('ALTER TABLE pck_packages DROP FOREIGN KEY FK_ECD2D94C6A33A739');
  39.         $this->addSql('ALTER TABLE pck_charges DROP FOREIGN KEY FK_5AC62D1B2FC0CB0F');
  40.         $this->addSql('ALTER TABLE pck_transactions_packages DROP FOREIGN KEY FK_16A877078F65F2B9');
  41.         $this->addSql('DROP TABLE pck_charges');
  42.         $this->addSql('DROP TABLE pck_packages');
  43.         $this->addSql('DROP TABLE pck_packagetypes');
  44.         $this->addSql('DROP TABLE pck_transactions');
  45.         $this->addSql('DROP TABLE pck_transactions_packages');
  46.     }
  47. }