diff --git a/config/services.yaml b/config/services.yaml index 99f25d14..9a2c3759 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -1,6 +1,6 @@ --- parameters: - roadiz_core.cms_version: '2.4.3' + roadiz_core.cms_version: '2.4.4' roadiz_core.cms_version_prefix: 'main' env(APP_NAMESPACE): "roadiz" env(APP_VERSION): "0.1.0" diff --git a/migrations/Version20201203004857.php b/migrations/Version20201203004857.php index 57294c19..755f4d67 100644 --- a/migrations/Version20201203004857.php +++ b/migrations/Version20201203004857.php @@ -4,6 +4,8 @@ namespace RZ\Roadiz\Migrations; +use Doctrine\DBAL\Platforms\MySQLPlatform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -21,9 +23,9 @@ public function up(Schema $schema): void { $this->skipIf($schema->hasTable('nodes'), 'Database has been initialized before Doctrine Migration tool.'); - if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof MySQLPlatform) { $this->mysqlUp(); - } elseif ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->postgresUp(); } } diff --git a/migrations/Version20201214232628.php b/migrations/Version20201214232628.php index 0f7a852c..31181fec 100644 --- a/migrations/Version20201214232628.php +++ b/migrations/Version20201214232628.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\Migrations; +use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -17,7 +18,7 @@ public function getDescription(): string public function up(Schema $schema): void { $this->skipIf( - 'mysql' !== $this->connection->getDatabasePlatform()->getName(), + !$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'Migration can only be executed safely on \'mysql\'.' ); $this->skipIf($schema->hasTable('usergroups'), 'Table `usergroups` already exists.'); @@ -37,7 +38,7 @@ public function up(Schema $schema): void public function down(Schema $schema): void { $this->skipIf( - 'mysql' !== $this->connection->getDatabasePlatform()->getName(), + !$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'Migration can only be executed safely on \'mysql\'.' ); $this->skipIf($schema->hasTable('groups'), 'Table `groups` already exists.'); diff --git a/migrations/Version20210423164248.php b/migrations/Version20210423164248.php index 044e1cfc..867979a0 100644 --- a/migrations/Version20210423164248.php +++ b/migrations/Version20210423164248.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\Migrations; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -23,7 +24,7 @@ public function up(Schema $schema): void $this->addSql('CREATE INDEX customform_node_position ON nodes_custom_forms (node_id, position)'); $this->addSql('CREATE INDEX customform_node_field_position ON nodes_custom_forms (node_id, node_type_field_id, position)'); - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('DROP INDEX IF EXISTS IDX_7C7DED6DE0D4FDE19CAA2B25'); $this->addSql('DROP INDEX IF EXISTS IDX_7C7DED6DE0D4FDE14AD260649CAA2B25'); $this->addSql('DROP INDEX IF EXISTS IDX_7C7DED6D2B36786BE0D4FDE19CAA2B25'); @@ -38,7 +39,7 @@ public function up(Schema $schema): void $this->addSql('CREATE INDEX ns_discr_translation_published ON nodes_sources (discr, translation_id, published_at)'); $this->addSql('CREATE INDEX ns_title_translation_published ON nodes_sources (title, translation_id, published_at)'); - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('ALTER INDEX IF EXISTS ns_node_translation_discr RENAME TO ns_node_discr_translation'); $this->addSql('ALTER INDEX IF EXISTS idx_7c7ded6d460d9fd79caa2b25e0d4fde1 RENAME TO ns_node_translation_published'); $this->addSql('ALTER INDEX IF EXISTS idx_7c7ded6d4ad260649caa2b25 RENAME TO ns_discr_translation'); @@ -67,7 +68,7 @@ public function up(Schema $schema): void public function down(Schema $schema): void { - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('DROP INDEX IF EXISTS answer_customform_submitted_at'); $this->addSql('DROP INDEX IF EXISTS cffattribute_answer_field'); $this->addSql('DROP INDEX IF EXISTS cfield_customform_positio'); @@ -95,7 +96,7 @@ public function down(Schema $schema): void $this->addSql('CREATE INDEX IDX_7C7DED6DE0D4FDE14AD260649CAA2B25 ON nodes_sources (published_at, discr, translation_id)'); $this->addSql('CREATE INDEX IDX_7C7DED6D2B36786BE0D4FDE19CAA2B25 ON nodes_sources (title, published_at, translation_id)'); - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('ALTER INDEX IF EXISTS ns_title_published RENAME TO IDX_7C7DED6D2B36786BE0D4FDE1'); $this->addSql('ALTER INDEX IF EXISTS ns_node_discr_translation RENAME TO ns_node_translation_discr'); $this->addSql('ALTER INDEX IF EXISTS ns_discr_translation RENAME TO IDX_7C7DED6D4AD260649CAA2B25'); diff --git a/migrations/Version20210506085247.php b/migrations/Version20210506085247.php index 11f2f7c3..2e0b630f 100644 --- a/migrations/Version20210506085247.php +++ b/migrations/Version20210506085247.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\Migrations; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -25,7 +26,7 @@ public function up(Schema $schema): void $this->addSql('CREATE INDEX node_visible_parent_position ON nodes (visible, parent_node_id, position)'); $this->addSql('CREATE INDEX node_status_visible_parent_position ON nodes (status, visible, parent_node_id, position)'); - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('ALTER INDEX IF EXISTS idx_1d3d05fc7ab0e8597b00651c3445eb91 RENAME TO node_visible_status_parent'); $this->addSql('ALTER INDEX IF EXISTS idx_1d3d05fc7ab0e8593445eb91 RENAME TO node_visible_parent'); } else { @@ -36,7 +37,7 @@ public function up(Schema $schema): void $this->addSql('CREATE INDEX tag_visible_position ON tags (visible, position)'); $this->addSql('CREATE INDEX tag_parent_visible_position ON tags (parent_tag_id, visible, position)'); - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('ALTER INDEX IF EXISTS idx_6fbc9426f5c1a0d77ab0e859 RENAME TO tag_parent_visible'); } else { $this->addSql('ALTER TABLE tags RENAME INDEX idx_6fbc9426f5c1a0d77ab0e859 TO tag_parent_visible'); @@ -45,7 +46,7 @@ public function up(Schema $schema): void public function down(Schema $schema): void { - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('DROP INDEX node_status_parent'); $this->addSql('DROP INDEX node_nodetype_status_parent'); $this->addSql('DROP INDEX node_nodetype_status_parent_position'); diff --git a/migrations/Version20210520092543.php b/migrations/Version20210520092543.php index 1b38b5ba..e608d442 100644 --- a/migrations/Version20210520092543.php +++ b/migrations/Version20210520092543.php @@ -4,6 +4,8 @@ namespace RZ\Roadiz\Migrations; +use Doctrine\DBAL\Platforms\MySQLPlatform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -19,14 +21,14 @@ public function getDescription(): string public function up(Schema $schema): void { - if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof MySQLPlatform) { /* * MYSQL */ $this->addSql('ALTER TABLE node_type_fields ADD serialization_exclusion_expression LONGTEXT DEFAULT NULL, ADD serialization_groups JSON DEFAULT NULL, ADD serialization_max_depth INT DEFAULT NULL, ADD excluded_from_serialization TINYINT(1) DEFAULT \'0\' NOT NULL'); $this->addSql('ALTER TABLE node_types ADD searchable TINYINT(1) DEFAULT \'1\' NOT NULL'); $this->addSql('CREATE INDEX nt_searchable ON node_types (searchable)'); - } elseif ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { /* * POSTGRES */ @@ -42,11 +44,11 @@ public function up(Schema $schema): void public function down(Schema $schema): void { - if ('mysql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof MySQLPlatform) { $this->addSql('ALTER TABLE node_type_fields DROP serialization_exclusion_expression, DROP serialization_groups, DROP serialization_max_depth, DROP excluded_from_serialization'); $this->addSql('DROP INDEX nt_searchable ON node_types'); $this->addSql('ALTER TABLE node_types DROP searchable'); - } elseif ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { /* * POSTGRES */ diff --git a/migrations/Version20210527131435.php b/migrations/Version20210527131435.php index 081ec0ae..4edaa888 100644 --- a/migrations/Version20210527131435.php +++ b/migrations/Version20210527131435.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\Migrations; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -16,7 +17,7 @@ public function getDescription(): string public function up(Schema $schema): void { - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('ALTER TABLE redirections ALTER redirecturi TYPE TEXT'); $this->addSql('ALTER TABLE redirections ALTER redirecturi DROP DEFAULT'); $this->addSql('ALTER TABLE redirections ALTER redirecturi TYPE TEXT'); @@ -27,7 +28,7 @@ public function up(Schema $schema): void public function down(Schema $schema): void { - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('ALTER TABLE redirections ALTER redirecturi TYPE VARCHAR(255)'); $this->addSql('ALTER TABLE redirections ALTER redirecturi DROP DEFAULT'); $this->addSql('ALTER TABLE redirections ALTER redirecturi TYPE VARCHAR(255)'); diff --git a/migrations/Version20210701151713.php b/migrations/Version20210701151713.php index c0e65fd7..714e0fa9 100644 --- a/migrations/Version20210701151713.php +++ b/migrations/Version20210701151713.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\Migrations; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -16,7 +17,7 @@ public function getDescription(): string public function up(Schema $schema): void { - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('CREATE TABLE webhooks (id VARCHAR(36) NOT NULL, message_type VARCHAR(255) DEFAULT NULL, uri TEXT DEFAULT NULL, payload JSON DEFAULT NULL, throttleSeconds INT NOT NULL, last_triggered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, automatic BOOLEAN DEFAULT \'false\' NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX webhook_message_type ON webhooks (message_type)'); $this->addSql('CREATE INDEX webhook_created_at ON webhooks (created_at)'); diff --git a/migrations/Version20210715120118.php b/migrations/Version20210715120118.php index 9a577148..8d0673c6 100644 --- a/migrations/Version20210715120118.php +++ b/migrations/Version20210715120118.php @@ -4,6 +4,7 @@ namespace RZ\Roadiz\Migrations; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -19,7 +20,7 @@ public function getDescription(): string public function up(Schema $schema): void { - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('ALTER TABLE webhooks ADD root_node INT DEFAULT NULL'); $this->addSql('ALTER TABLE webhooks ADD CONSTRAINT FK_998C4FDDC2A25172 FOREIGN KEY (root_node) REFERENCES nodes (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); } else { @@ -31,7 +32,7 @@ public function up(Schema $schema): void public function down(Schema $schema): void { - if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { $this->addSql('ALTER TABLE webhooks DROP CONSTRAINT FK_998C4FDDC2A25172'); $this->addSql('DROP INDEX webhook_root_node'); } else { diff --git a/src/Entity/NodeType.php b/src/Entity/NodeType.php index e41f85ad..963afe18 100644 --- a/src/Entity/NodeType.php +++ b/src/Entity/NodeType.php @@ -53,7 +53,6 @@ class NodeType extends AbstractEntity implements NodeTypeInterface Serializer\Type('string'), Assert\NotNull(), Assert\NotBlank(), - RoadizAssert\NonSqlReservedWord(), RoadizAssert\SimpleLatinString(), // Limit discriminator column to 30 characters for indexing optimization Assert\Length(max: 30) diff --git a/src/Form/Constraint/NonSqlReservedWord.php b/src/Form/Constraint/NonSqlReservedWord.php index deb5ff7e..d408a6cf 100644 --- a/src/Form/Constraint/NonSqlReservedWord.php +++ b/src/Form/Constraint/NonSqlReservedWord.php @@ -27,7 +27,6 @@ class NonSqlReservedWord extends Constraint 'active', 'add', 'admin', - 'admin', 'after', 'against', 'aggregate', @@ -39,7 +38,6 @@ class NonSqlReservedWord extends Constraint 'and', 'any', 'array', - 'array', 'as', 'asc', 'ascii', @@ -280,7 +278,6 @@ class NonSqlReservedWord extends Constraint 'import', 'in', 'inactive', - 'inactive', 'index', 'indexes', 'infile', @@ -404,7 +401,6 @@ class NonSqlReservedWord extends Constraint 'mediumint', 'mediumtext', 'member', - 'member', 'memory', 'merge', 'message_text', @@ -450,21 +446,15 @@ class NonSqlReservedWord extends Constraint 'nth_value', 'nth_value', 'ntile', - 'ntile', 'null', 'nulls', - 'nulls', 'number', 'numeric', 'nvarchar', 'of', - 'of', - 'off', 'off', 'offset', 'oj', - 'oj', - 'old', 'old', 'on', 'one', @@ -474,22 +464,17 @@ class NonSqlReservedWord extends Constraint 'optimizer_costs', 'option', 'optional', - 'optional', 'optionally', 'options', 'or', 'order', 'ordinality', - 'ordinality', 'organization', - 'organization', - 'others', 'others', 'out', 'outer', 'outfile', 'over', - 'over', 'owner', 'pack_keys', 'page', @@ -500,14 +485,9 @@ class NonSqlReservedWord extends Constraint 'partitions', 'password', 'password_lock_time', - 'password_lock_time', 'path', - 'path', - 'percent_rank', 'percent_rank', 'persist', - 'persist', - 'persist_only', 'persist_only', 'phase', 'plugin', @@ -518,18 +498,15 @@ class NonSqlReservedWord extends Constraint 'port', 'precedes', 'preceding', - 'preceding', 'precision', 'prepare', 'preserve', 'prev', 'primary', 'privilege_checks_user', - 'privilege_checks_user', 'privileges', 'procedure', 'process', - 'process', 'processlist', 'profile', 'profiles', @@ -539,10 +516,8 @@ class NonSqlReservedWord extends Constraint 'query', 'quick', 'random', - 'random', 'range', 'rank', - 'rank', 'read', 'read_only', 'read_write', @@ -551,16 +526,13 @@ class NonSqlReservedWord extends Constraint 'rebuild', 'recover', 'recursive', - 'recursive', 'redo_buffer_size', 'redofile', 'redundant', 'reference', - 'reference', 'references', 'regexp', 'registration', - 'registration', 'relay', 'relay_log_file', 'relay_log_pos', @@ -577,8 +549,6 @@ class NonSqlReservedWord extends Constraint 'repeatable', 'replace', 'replica', - 'replica', - 'replicas', 'replicas', 'replicate_do_db', 'replicate_do_table', @@ -594,20 +564,15 @@ class NonSqlReservedWord extends Constraint 'reset', 'resignal', 'resource', - 'resource', - 'respect', 'respect', 'restart', - 'restart', 'restore', 'restrict', 'resume', 'retain', - 'retain', 'return', 'returned_sqlstate', 'returning', - 'returning', 'returns', 'reuse', 'reuse', @@ -616,7 +581,6 @@ class NonSqlReservedWord extends Constraint 'right', 'rlike', 'role', - 'role', 'rollback', 'rollup', 'rotate', @@ -636,14 +600,9 @@ class NonSqlReservedWord extends Constraint 'second', 'second_microsecond', 'secondary', - 'secondary', - 'secondary_engine', 'secondary_engine', 'secondary_engine_attribute', - 'secondary_engine_attribute', 'secondary_load', - 'secondary_load', - 'secondary_unload', 'secondary_unload', 'security', 'select', @@ -672,56 +631,30 @@ class NonSqlReservedWord extends Constraint 'sounds', 'source', 'source_auto_position', - 'source_auto_position', - 'source_bind', 'source_bind', 'source_compression_algorithms', - 'source_compression_algorithms', - 'source_connect_retry', 'source_connect_retry', 'source_delay', - 'source_delay', - 'source_heartbeat_period', 'source_heartbeat_period', 'source_host', - 'source_host', 'source_log_file', - 'source_log_file', - 'source_log_pos', 'source_log_pos', 'source_password', - 'source_password', - 'source_port', 'source_port', 'source_public_key_path', - 'source_public_key_path', - 'source_retry_count', 'source_retry_count', 'source_ssl', - 'source_ssl', - 'source_ssl_ca', 'source_ssl_ca', 'source_ssl_capath', - 'source_ssl_capath', 'source_ssl_cert', - 'source_ssl_cert', - 'source_ssl_cipher', 'source_ssl_cipher', 'source_ssl_crl', - 'source_ssl_crl', - 'source_ssl_crlpath', 'source_ssl_crlpath', 'source_ssl_key', - 'source_ssl_key', - 'source_ssl_verify_server_cert', 'source_ssl_verify_server_cert', 'source_tls_ciphersuites', - 'source_tls_ciphersuites', - 'source_tls_version', 'source_tls_version', 'source_user', - 'source_user', - 'source_zstd_compression_level', 'source_zstd_compression_level', 'spatial', 'specific', @@ -762,7 +695,6 @@ class NonSqlReservedWord extends Constraint 'stored', 'straight_join', 'stream', - 'stream', 'string', 'subclass_origin', 'subject', @@ -773,7 +705,6 @@ class NonSqlReservedWord extends Constraint 'swaps', 'switches', 'system', - 'system', 'table', 'table_checksum', 'table_name', @@ -783,11 +714,8 @@ class NonSqlReservedWord extends Constraint 'temptable', 'terminated', 'text', - 'than', 'then', 'thread_priority', - 'thread_priority', - 'ties', 'ties', 'time', 'timestamp',