migrations/Version20181103144042.php line 1
<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: added user of last change for user entity
*/
class Version20181103144042 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE users ADD users_id INT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE media ALTER users_id DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN users.users_id IS \'Creating/editing user\'');
$this->addSql('ALTER TABLE users ADD CONSTRAINT fk_users_users FOREIGN KEY (users_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
//$this->addSql('CREATE INDEX IDX_1483A5E967B3B43D ON users (users_id)');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
//$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE users DROP CONSTRAINT fk_users_users');
//$this->addSql('DROP INDEX IDX_1483A5E967B3B43D');
$this->addSql('ALTER TABLE users DROP users_id');
}
}