From 79877c787eaec288247bc67980ebc7b0aa7cdde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 25 Sep 2022 19:29:03 +0200 Subject: [PATCH] Change row format of tables before creating indices This is nee --- README.md | 2 +- migrations/Version20220925162725.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c97b225f..4c0ed1c3 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Part-DB is also used by small companies and universities for managing their inve ## Requirements * A **web server** (like Apache2 or nginx) that is capable of running [Symfony 5](https://symfony.com/doc/current/reference/requirements.html), this includes a minimum PHP version of **PHP 7.4** - * A **MySQL** (at least 5.6.5) /**MariaDB** (at least 10.0.1) database server if you do not want to use SQLite. + * A **MySQL** (at least 5.7) /**MariaDB** (at least 10.2.2) database server if you do not want to use SQLite. * Shell access to your server is highly suggested! * For building the client side assets **yarn** and **nodejs** is needed. diff --git a/migrations/Version20220925162725.php b/migrations/Version20220925162725.php index 65f966c4..1f7e7250 100644 --- a/migrations/Version20220925162725.php +++ b/migrations/Version20220925162725.php @@ -20,6 +20,30 @@ final class Version20220925162725 extends AbstractMultiPlatformMigration public function mySQLUp(Schema $schema): void { + //Change row format to dynamic to allow longer indices (this step is only needed for databases created with an older MySQL/MariaDB version + $this->addSql('ALTER TABLE attachments ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE attachment_types ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE categories ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE devices ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE device_parts ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE footprints ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE groups ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE internal ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE label_profiles ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE log ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE manufacturers ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE measurement_units ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE migration_versions ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE orderdetails ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE parameters ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE parts ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE part_lots ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE pricedetails ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE storelocations ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE suppliers ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE u2f_keys ROW_FORMAT=DYNAMIC'); + $this->addSql('ALTER TABLE users ROW_FORMAT=DYNAMIC'); + // this up() migration is auto-generated, please modify it to your needs $this->addSql('CREATE INDEX attachment_types_idx_name ON attachment_types (name)'); $this->addSql('CREATE INDEX attachment_types_idx_parent_name ON attachment_types (parent_id, name)');