diff --git a/.gitlab-ci-files/test.yml b/.gitlab-ci-files/test.yml index f431560..66642be 100644 --- a/.gitlab-ci-files/test.yml +++ b/.gitlab-ci-files/test.yml @@ -36,7 +36,6 @@ debian12-test: .debian-test: extends: .test script: - - pwd - apt update - apt install -y ./build/*.deb - cd /opt/belledonne-communications/share/flexisip-account-manager/flexiapi @@ -54,6 +53,29 @@ remi-rocky8-test: script: - yum -y localinstall build/*.rpm +mysql-latest-test: + extends: .test + image: gitlab.linphone.org:4567/bc/public/docker/debian12-php:$DEBIAN_12_IMAGE_VERSION + needs: + - debian12-package + services: + - mysql + variables: + MYSQL_ROOT_PASSWORD: flexiapi + MYSQL_DATABASE: flexiapi + DB_HOST: mysql + DB_DATABASE: flexiapi + DB_PASSWORD: flexiapi + DB_USERNAME: root + script: + - apt update + - apt install -y ./build/*.deb + - cd /opt/belledonne-communications/share/flexisip-account-manager/flexiapi + - composer install --dev + - php artisan db:show + - php artisan migrate + - php artisan migrate:rollback + .test: tags: ["docker"] stage: test diff --git a/flexiapi/database/migrations/2021_09_16_120958_add_unique_accounts_passwords_aliases_table.php b/flexiapi/database/migrations/2021_09_16_120958_add_unique_accounts_passwords_aliases_table.php index fa4bce9..6f0c78e 100644 --- a/flexiapi/database/migrations/2021_09_16_120958_add_unique_accounts_passwords_aliases_table.php +++ b/flexiapi/database/migrations/2021_09_16_120958_add_unique_accounts_passwords_aliases_table.php @@ -46,10 +46,20 @@ class AddUniqueAccountsPasswordsAliasesTable extends Migration $table->dropUnique(['username', 'domain']); }); + // Some versions of MySQL have a weird behavior between their FK and indexes + // See https://stackoverflow.com/questions/8482346/mysql-cannot-drop-index-needed-in-a-foreign-key-constraint + // We need to drop the foreign key to recreate it just after... + Schema::table('passwords', function (Blueprint $table) { + $table->dropForeign('passwords_account_id_foreign'); $table->dropUnique(['account_id', 'algorithm']); }); + Schema::table('passwords', function (Blueprint $table) { + $table->foreign('account_id')->references('id') + ->on('accounts')->onDelete('cascade'); + }); + Schema::table('aliases', function (Blueprint $table) { $table->dropUnique(['alias', 'domain']); }); diff --git a/flexiapi/database/migrations/2023_09_14_132627_create_statistics_calls_table.php b/flexiapi/database/migrations/2023_09_14_132627_create_statistics_calls_table.php index 2dc7954..1578e23 100644 --- a/flexiapi/database/migrations/2023_09_14_132627_create_statistics_calls_table.php +++ b/flexiapi/database/migrations/2023_09_14_132627_create_statistics_calls_table.php @@ -91,6 +91,7 @@ return new class extends Migration }); Schema::table('statistics_message_devices', function(Blueprint $table) { + $table->dropForeign('statistics_message_devices_message_id_foreign'); $table->dropUnique('statistics_message_devices_message_id_to_u_to_d_device_id_unique'); $table->dropColumn('to_username'); $table->dropColumn('to_domain');