<?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 Version20220104091341 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 SEQUENCE transaction_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE transaction (id INT NOT NULL, intercom_user_id INT DEFAULT NULL, reader_id VARCHAR(255) DEFAULT NULL, country_code VARCHAR(5) NOT NULL, currency VARCHAR(5) NOT NULL, price DOUBLE PRECISION NOT NULL, price_in_purchased_currency DOUBLE PRECISION NOT NULL, product_id VARCHAR(30) NOT NULL, store VARCHAR(30) NOT NULL, takehome_percentage NUMERIC(5, 2) NOT NULL, transaction_id VARCHAR(255) NOT NULL, purchased_at TIMESTAMP(0) WITH TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_723705D17D50FB54 ON transaction (intercom_user_id)');
$this->addSql('ALTER TABLE transaction ADD CONSTRAINT FK_723705D17D50FB54 FOREIGN KEY (intercom_user_id) REFERENCES intercom_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE transaction_id_seq CASCADE');
$this->addSql('DROP TABLE transaction');
}
}