mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 10:08:05 +00:00
Fix #101 Add a MySQL migration test in the pipeline
This commit is contained in:
parent
4a5d7b6aee
commit
46ff32f6c4
3 changed files with 34 additions and 1 deletions
|
|
@ -36,7 +36,6 @@ debian12-test:
|
||||||
.debian-test:
|
.debian-test:
|
||||||
extends: .test
|
extends: .test
|
||||||
script:
|
script:
|
||||||
- pwd
|
|
||||||
- apt update
|
- apt update
|
||||||
- apt install -y ./build/*.deb
|
- apt install -y ./build/*.deb
|
||||||
- cd /opt/belledonne-communications/share/flexisip-account-manager/flexiapi
|
- cd /opt/belledonne-communications/share/flexisip-account-manager/flexiapi
|
||||||
|
|
@ -54,6 +53,29 @@ remi-rocky8-test:
|
||||||
script:
|
script:
|
||||||
- yum -y localinstall build/*.rpm
|
- 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:
|
.test:
|
||||||
tags: ["docker"]
|
tags: ["docker"]
|
||||||
stage: test
|
stage: test
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,20 @@ class AddUniqueAccountsPasswordsAliasesTable extends Migration
|
||||||
$table->dropUnique(['username', 'domain']);
|
$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) {
|
Schema::table('passwords', function (Blueprint $table) {
|
||||||
|
$table->dropForeign('passwords_account_id_foreign');
|
||||||
$table->dropUnique(['account_id', 'algorithm']);
|
$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) {
|
Schema::table('aliases', function (Blueprint $table) {
|
||||||
$table->dropUnique(['alias', 'domain']);
|
$table->dropUnique(['alias', 'domain']);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ return new class extends Migration
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('statistics_message_devices', function(Blueprint $table) {
|
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->dropUnique('statistics_message_devices_message_id_to_u_to_d_device_id_unique');
|
||||||
$table->dropColumn('to_username');
|
$table->dropColumn('to_username');
|
||||||
$table->dropColumn('to_domain');
|
$table->dropColumn('to_domain');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue