Add support for MySQL 5.5

Enable foreign key support for the external schema
Bump version
This commit is contained in:
Timothée Jaussoin 2021-05-11 16:08:40 +02:00
parent ad69828d60
commit 0279acca0c
12 changed files with 34 additions and 18 deletions

View file

@ -9,9 +9,9 @@ class CreateUsersTable extends Migration
public function up()
{
Schema::connection('local')->create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('email', 160)->unique(); // Because we (still) need to support MySQL 5.5 and its 767 bytes limit ¯\_(ツ)_/¯
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();

View file

@ -26,7 +26,7 @@ class CreateFailedJobsTable extends Migration
public function up()
{
Schema::connection('local')->create('failed_jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->text('connection');
$table->text('queue');
$table->longText('payload');

View file

@ -27,7 +27,7 @@ class CreateAccountsPasswordsTables extends Migration
{
if (!Schema::connection('external')->hasTable('accounts')) {
Schema::connection('external')->create('accounts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->string('username', 64);
$table->string('domain', 64);
$table->string('email', 64)->nullable();
@ -43,13 +43,13 @@ class CreateAccountsPasswordsTables extends Migration
if (!Schema::connection('external')->hasTable('passwords')) {
Schema::connection('external')->create('passwords', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->integer('account_id')->unsigned();
$table->string('password', 255);
$table->string('algorithm', 10)->default('MD5');
//$table->foreign('account_id')->references('id')
// ->on('accounts')->onDelete('cascade');
$table->foreign('account_id')->references('id')
->on('accounts')->onDelete('cascade');
$table->timestamps();
});

View file

@ -26,11 +26,14 @@ class CreateNoncesDigestTable extends Migration
public function up()
{
Schema::connection('local')->create('nonces', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->integer('account_id')->unsigned();
$table->string('nonce');
$table->integer('nc')->default(0);
$table->timestamps();
//$table->foreign('account_id')->references('id')
// ->on('accounts')->onDelete('cascade');
});
}

View file

@ -26,9 +26,12 @@ class CreateAdminsTable extends Migration
public function up()
{
Schema::connection('local')->create('admins', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->integer('account_id')->unsigned();
$table->timestamps();
//$table->foreign('account_id')->references('id')
// ->on('accounts')->onDelete('cascade');
});
}

View file

@ -26,11 +26,14 @@ class AddEmailChangedTable extends Migration
public function up()
{
Schema::connection('local')->create('email_changed', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->integer('account_id')->unsigned()->unique();
$table->string('new_email');
$table->string('hash');
$table->timestamps();
//$table->foreign('account_id')->references('id')
// ->on('accounts')->onDelete('cascade');
});
}

View file

@ -26,15 +26,18 @@ class CreateApiKeysTable extends Migration
public function up()
{
Schema::connection('local')->create('api_keys', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->integer('account_id')->unsigned()->unique();
$table->string('key')->unique();
$table->string('key', 160)->unique(); // MySQL 5.5 limit…
$table->timestamps();
//$table->foreign('account_id')->references('id')
// ->on('accounts')->onDelete('cascade');
});
}
public function down()
{
Schema::dropIfExists('api_keys');
Schema::connection('local')->dropIfExists('api_keys');
}
}

View file

@ -17,7 +17,7 @@ class CreateAliasesTable extends Migration
$table->string('domain', 64);
$table->foreign('account_id')->references('id')
->on('accounts')->onDelete('cascade');
->on('accounts')->onDelete('cascade');
});
}
}

View file

@ -9,11 +9,14 @@ class AddPhoneChangeCodesTable extends Migration
public function up()
{
Schema::connection('local')->create('phone_change_codes', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->integer('account_id')->unsigned();
$table->string('code');
$table->string('phone');
$table->timestamps();
//$table->foreign('account_id')->references('id')
// ->on('accounts')->onDelete('cascade');
});
}

View file

@ -13,6 +13,9 @@ class CreateActivationExpirationsTable extends Migration
$table->integer('account_id')->unsigned();
$table->dateTime('expires');
$table->timestamps();
//$table->foreign('account_id')->references('id')
// ->on('accounts')->onDelete('cascade');
});
}

View file

@ -17,8 +17,6 @@
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<server name="DB_DRIVER" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
<server name="DB_EXTERNAL_DRIVER" value="sqlite"/>
<server name="DB_EXTERNAL_DATABASE" value=":memory:"/>
<server name="MAIL_DRIVER" value="array"/>

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 71
%define build_number 72
%define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager