Answer the question
In order to leave comments, you need to log in
Alter table with IF conditions?
[notice] Migrating up to DoctrineMigrations\Version20200907062416
[error] Migration DoctrineMigrations\Version20200209084310 failed during Execution. Error: "An exception occurred while executing 'ALTER TABLE useraccounts_v3 ADD IF NOT EXISTS token VARCHAR(255) DEFAULT NULL':
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS token VARCHAR(255) DEFAULT NULL' at line 1"
In AbstractMySQLDriver.php line 79:
An exception occurred while executing 'ALTER TABLE useraccounts_v3 ADD IF NOT EXISTS token VARCHAR(255) DEFAU
LT NULL':
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manua
l that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS token VARCHAR
(255) DEFAULT NULL' at line 1
In PDOConnection.php line 43:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manua
l that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS token VARCHAR
(255) DEFAULT NULL' at line 1
In PDOConnection.php line 41:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manua
l that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS token VARCHAR
(255) DEFAULT NULL' at line 1
IF NOT EXISTS
IF EXISTS
$this->addSql('ALTER TABLE member DROP IF EXISTS avatar_url');
$this->addSql('ALTER TABLE member ADD IF NOT EXISTS first_login_at DATETIME DEFAULT NULL'');
$this->addSql('ALTER TABLE cron_report ADD IF NOT EXISTS CONSTRAINT FK_B6C6A7F5BE04EA9 FOREIGN KEY (job_id) REFERENCES cron_job (id) ON DELETE CASCADE');
$this->addSql('CREATE UNIQUE INDEX UNIQ_302770B57597D3FE ON useraccounts_v3 (member_id)');
Answer the question
In order to leave comments, you need to log in
several projects from different teams are connected to one database and the devil knows what columns and data are there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question