55namespace PhpList \Core \Migrations ;
66
77use Doctrine \DBAL \Platforms \PostgreSQLPlatform ;
8- use Doctrine \DBAL \Platforms \MySQLPlatform ;
98use Doctrine \Migrations \AbstractMigration ;
109use Doctrine \DBAL \Schema \Schema ;
1110
@@ -209,17 +208,6 @@ public function up(Schema $schema): void
209208 $ this ->addSql ('ALTER TABLE phplist_user_user_history ADD CONSTRAINT FK_6DBB605CF132696E FOREIGN KEY (userid) REFERENCES phplist_user_user (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE ' );
210209 $ this ->addSql ('ALTER TABLE phplist_usermessage ADD CONSTRAINT FK_7F30F469F132696E FOREIGN KEY (userid) REFERENCES phplist_user_user (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE ' );
211210 $ this ->addSql ('ALTER TABLE phplist_usermessage ADD CONSTRAINT FK_7F30F46931478478 FOREIGN KEY (messageid) REFERENCES phplist_message (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE ' );
212-
213- $ sm = $ this ->connection ->createSchemaManager ();
214- if ($ sm ->tablesExist (['feed ' ])) {
215- $ this ->addSql ('ALTER TABLE feed ALTER id DROP DEFAULT ' );
216- $ this ->addSql ('ALTER TABLE feed ALTER etag DROP DEFAULT ' );
217- $ this ->addSql ('ALTER TABLE feed ALTER lastmodified DROP DEFAULT ' );
218- $ this ->addSql ('ALTER TABLE item ALTER id DROP DEFAULT ' );
219- $ this ->addSql ('ALTER TABLE item_data DROP CONSTRAINT fk_itemdata_item ' );
220- $ this ->addSql ('ALTER TABLE item_data ALTER value SET NOT NULL ' );
221- $ this ->addSql ('ALTER TABLE item_data ADD CONSTRAINT FK_65C3B798207C93D3 FOREIGN KEY (itemid) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE ' );
222- }
223211 }
224212
225213 public function down (Schema $ schema ): void
@@ -230,7 +218,6 @@ public function down(Schema $schema): void
230218 get_class ($ platform )
231219 ));
232220
233- $ this ->addSql ('CREATE SCHEMA public ' );
234221 $ this ->addSql ('DROP SEQUENCE phplist_admin_id_seq CASCADE ' );
235222 $ this ->addSql ('DROP SEQUENCE phplist_admin_login_id_seq CASCADE ' );
236223 $ this ->addSql ('DROP SEQUENCE phplist_admin_password_request_id_key_seq CASCADE ' );
@@ -320,20 +307,5 @@ public function down(Schema $schema): void
320307 $ this ->addSql ('DROP TABLE phplist_user_user_history ' );
321308 $ this ->addSql ('DROP TABLE phplist_usermessage ' );
322309 $ this ->addSql ('DROP TABLE phplist_userstats ' );
323-
324- $ sm = $ this ->connection ->createSchemaManager ();
325- if ($ sm ->tablesExist (['feed ' ])) {
326- $ this ->addSql ('CREATE SEQUENCE feed_id_seq ' );
327- $ this ->addSql ('SELECT setval( \'feed_id_seq \', (SELECT MAX(id) FROM feed)) ' );
328- $ this ->addSql ('ALTER TABLE feed ALTER id SET DEFAULT nextval( \'feed_id_seq \') ' );
329- $ this ->addSql ('ALTER TABLE feed ALTER etag SET DEFAULT \'\'' );
330- $ this ->addSql ('ALTER TABLE feed ALTER lastmodified SET DEFAULT \'\'' );
331- $ this ->addSql ('CREATE SEQUENCE item_id_seq ' );
332- $ this ->addSql ('SELECT setval( \'item_id_seq \', (SELECT MAX(id) FROM item)) ' );
333- $ this ->addSql ('ALTER TABLE item ALTER id SET DEFAULT nextval( \'item_id_seq \') ' );
334- $ this ->addSql ('ALTER TABLE item_data DROP CONSTRAINT FK_65C3B798207C93D3 ' );
335- $ this ->addSql ('ALTER TABLE item_data ALTER value DROP NOT NULL ' );
336- $ this ->addSql ('ALTER TABLE item_data ADD CONSTRAINT fk_itemdata_item FOREIGN KEY (itemid) REFERENCES item (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE ' );
337- }
338310 }
339311}
0 commit comments