WIP: Symfony 6 project remake #2

Draft
skobkin wants to merge 103 commits from symfony6_remake into master
18 changed files with 142 additions and 248 deletions
Showing only changes of commit e482b4567a - Show all commits

View file

@ -4,3 +4,7 @@ doctrine_migrations:
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/migrations'
enable_profiler: false
storage:
table_storage:
table_name: 'migration_versions'
check_database_platform: true

View file

@ -1,19 +1,23 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* PostgreSQL database initialization
*/
class Version20150528203127 extends AbstractMigration
final class Version20150528203127 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
public function getDescription(): string
{
return 'Initial migration';
}
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
@ -37,10 +41,7 @@ class Version20150528203127 extends AbstractMigration
$this->addSql('ALTER TABLE subscriptions.log ADD CONSTRAINT FK_22DA64DD7808B1AD FOREIGN KEY (subscriber_id) REFERENCES users.users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

View file

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Deletes user login unique index. Temporary fix for user renaming.
*/
final class Version20151001210600 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('DROP INDEX users.uniq_338adfc4aa08cb10');
}
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE UNIQUE INDEX uniq_338adfc4aa08cb10 ON users.users (login)');
}
}

View file

@ -1,32 +1,23 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160324002719 extends AbstractMigration
final class Version20160324002719 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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.users ADD updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
}
/**
* @param Schema $schema
*/
public function down(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('ALTER TABLE users.users DROP updated_at');

View file

@ -1,21 +1,16 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160324005746 extends AbstractMigration
final class Version20160324005746 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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('CREATE SCHEMA IF NOT EXISTS posts');
@ -45,12 +40,8 @@ class Version20160324005746 extends AbstractMigration
$this->addSql('ALTER TABLE posts.posts_tags ADD CONSTRAINT FK_7870CC82BAD26311 FOREIGN KEY (tag_id) REFERENCES posts.tags (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
}
/**
* @param Schema $schema
*/
public function down(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('ALTER TABLE posts.comments DROP CONSTRAINT FK_62899975727ACA70');

View file

@ -1,32 +1,23 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160324011937 extends AbstractMigration
final class Version20160324011937 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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 posts.posts ALTER updated_at DROP NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(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('ALTER TABLE posts.posts ALTER updated_at SET NOT NULL');

View file

@ -1,21 +1,16 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160325001415 extends AbstractMigration
final class Version20160325001415 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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('CREATE SEQUENCE posts.files_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
@ -33,12 +28,8 @@ class Version20160325001415 extends AbstractMigration
$this->addSql('ALTER TABLE posts.posts_files ADD CONSTRAINT FK_D799EBF093CB796C FOREIGN KEY (file_id) REFERENCES posts.files (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
/**
* @param Schema $schema
*/
public function down(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('ALTER TABLE posts.comments_files DROP CONSTRAINT FK_D0F6932993CB796C');

View file

@ -1,21 +1,16 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160326030437 extends AbstractMigration
final class Version20160326030437 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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 posts.comments ALTER post_id TYPE TEXT');
@ -30,12 +25,8 @@ class Version20160326030437 extends AbstractMigration
$this->addSql('CREATE UNIQUE INDEX UNIQ_744CC52C68EA44FC ON posts.files (remote_url)');
}
/**
* @param Schema $schema
*/
public function down(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('ALTER TABLE posts.comments ALTER post_id TYPE VARCHAR(16)');

View file

@ -1,21 +1,16 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160328060523 extends AbstractMigration
final class Version20160328060523 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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('CREATE SEQUENCE users.rename_log_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
@ -26,12 +21,8 @@ class Version20160328060523 extends AbstractMigration
$this->addSql('ALTER TABLE users.rename_log ADD CONSTRAINT FK_10D64DDA76ED395 FOREIGN KEY (user_id) REFERENCES users.users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
/**
* @param Schema $schema
*/
public function down(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('DROP SEQUENCE users.rename_log_id_seq CASCADE');

View file

@ -1,32 +1,23 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20160329035248 extends AbstractMigration
final class Version20160329035248 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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.rename_log DROP new_login');
}
/**
* @param Schema $schema
*/
public function down(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('ALTER TABLE users.rename_log ADD new_login TEXT DEFAULT \'\'');

View file

@ -1,21 +1,19 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Telegram accounts added
*/
class Version20170105191821 extends AbstractMigration
final class Version20170105191821 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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('CREATE TABLE users.telegram_accounts (account_id INT NOT NULL, user_id INT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, linked_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, first_name TEXT NOT NULL, last_name TEXT DEFAULT NULL, username TEXT DEFAULT NULL, private_chat_id BIGINT DEFAULT NULL, subscriber_notification BOOLEAN NOT NULL, rename_notification BOOLEAN NOT NULL, PRIMARY KEY(account_id))');
@ -25,12 +23,8 @@ class Version20170105191821 extends AbstractMigration
$this->addSql('ALTER TABLE users.telegram_accounts ADD CONSTRAINT FK_1EDB9B25A76ED395 FOREIGN KEY (user_id) REFERENCES users.users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
/**
* @param Schema $schema
*/
public function down(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('DROP TABLE users.telegram_accounts');

View file

@ -1,30 +1,24 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
class Version20170108152129 extends AbstractMigration
final class Version20170108152129 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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 INDEX subscriptions.idx_22da64ddf675f31b RENAME TO author_idx');
$this->addSql('ALTER INDEX subscriptions.idx_22da64dd7808b1ad RENAME TO subscriber_idx');
}
/**
* @param Schema $schema
*/
public function down(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('ALTER INDEX subscriptions.subscriber_idx RENAME TO idx_22da64dd7808b1ad');

View file

@ -1,29 +1,23 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
class Version20170108153353 extends AbstractMigration
final class Version20170108153353 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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('CREATE INDEX idx_tag_text ON posts.tags (text)');
}
/**
* @param Schema $schema
*/
public function down(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('DROP INDEX posts.idx_tag_text');

View file

@ -1,32 +1,26 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* User removal support
*/
class Version20170116224555 extends AbstractMigration
final class Version20170116224555 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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.users ADD is_removed BOOLEAN DEFAULT FALSE NOT NULL');
}
/**
* @param Schema $schema
*/
public function down(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('ALTER TABLE users.users DROP is_removed');

View file

@ -1,21 +1,19 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* New fields for User entity: 'public' and 'whitelistOnly' (privacy support)
*/
class Version20171104182713 extends AbstractMigration
final class Version20171104182713 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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.users ADD public BOOLEAN DEFAULT FALSE NOT NULL');
@ -24,12 +22,8 @@ class Version20171104182713 extends AbstractMigration
$this->addSql('CREATE INDEX idx_user_removed ON users.users (is_removed)');
}
/**
* @param Schema $schema
*/
public function down(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('DROP INDEX users.idx_user_public');

View file

@ -1,32 +1,26 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* subscription_unique index was removed because it was duplicating PK of the table.
*/
class Version20171106013937 extends AbstractMigration
final class Version20171106013937 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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('DROP INDEX subscriptions.subscription_unique');
}
/**
* @param Schema $schema
*/
public function down(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 UNIQUE INDEX subscription_unique ON subscriptions.subscriptions (author_id, subscriber_id)');

View file

@ -1,21 +1,19 @@
<?php
namespace Application\Migrations;
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Schema refactoring
*/
class Version20171106023155 extends AbstractMigration
final class Version20171106023155 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(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 INDEX subscriptions.author_idx RENAME TO idx_subscription_author');
@ -26,12 +24,8 @@ class Version20171106023155 extends AbstractMigration
$this->addSql('DROP INDEX posts.idx_tag_text');
}
/**
* @param Schema $schema
*/
public function down(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 INDEX idx_tag_text ON posts.tags (text)');

View file

@ -1,34 +0,0 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Deletes user login unique index. Temporary fix for user renaming.
*/
class Version20151001210600 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// 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('DROP INDEX users.uniq_338adfc4aa08cb10');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// 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 UNIQUE INDEX uniq_338adfc4aa08cb10 ON users.users (login)');
}
}