addSql('CREATE TEMPORARY TABLE __temp__registration_token AS SELECT id, user_id FROM registration_token'); $this->addSql('DROP TABLE registration_token'); $this->addSql('CREATE TABLE registration_token (id BLOB NOT NULL --(DC2Type:uuid) , user_id INTEGER DEFAULT NULL, created_by_id INTEGER NOT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable) , PRIMARY KEY(id), CONSTRAINT FK_D09D01D3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_D09D01D3B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); $this->addSql('INSERT INTO registration_token (id, user_id) SELECT id, user_id FROM __temp__registration_token'); $this->addSql('DROP TABLE __temp__registration_token'); $this->addSql('CREATE UNIQUE INDEX UNIQ_D09D01D3A76ED395 ON registration_token (user_id)'); $this->addSql('CREATE INDEX IDX_D09D01D3B03A8386 ON registration_token (created_by_id)'); } public function down(Schema $schema): void { $this->addSql('CREATE TEMPORARY TABLE __temp__registration_token AS SELECT id, user_id FROM registration_token'); $this->addSql('DROP TABLE registration_token'); $this->addSql('CREATE TABLE registration_token (id BLOB NOT NULL --(DC2Type:uuid) , user_id INTEGER DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_D09D01D3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); $this->addSql('INSERT INTO registration_token (id, user_id) SELECT id, user_id FROM __temp__registration_token'); $this->addSql('DROP TABLE __temp__registration_token'); $this->addSql('CREATE UNIQUE INDEX UNIQ_D09D01D3A76ED395 ON registration_token (user_id)'); } }