fix editing orders

This commit is contained in:
Ludovic CANDELLIER
2022-11-19 23:43:12 +01:00
parent 782809829b
commit d33b5eea52
19 changed files with 314 additions and 174 deletions

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
class CreateRevisionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('revisions', function ($table) {
$table->bigIncrements('id');
$table->string('revisionable_type');
$table->unsignedBigInteger('revisionable_id');
$table->unsignedBigInteger('user_id')->nullable();
$table->string('key');
$table->text('old_value')->nullable();
$table->text('new_value')->nullable();
$table->timestamps();
$table->index(array('revisionable_id', 'revisionable_type'));
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('revisions');
}
}

View File

@@ -1,83 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class TeamworkSetupTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table(\Config::get('teamwork.users_table'), function (Blueprint $table) {
$table->integer('current_team_id')->unsigned()->nullable();
});
Schema::create(\Config::get('teamwork.teams_table'), function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('owner_id')->unsigned()->nullable();
$table->string('name');
$table->timestamps();
});
Schema::create(\Config::get('teamwork.team_user_table'), function (Blueprint $table) {
$table->bigInteger('user_id')->unsigned();
$table->integer('team_id')->unsigned();
$table->timestamps();
$table->foreign('user_id')
->references(\Config::get('teamwork.user_foreign_key'))
->on(\Config::get('teamwork.users_table'))
->onUpdate('cascade')
->onDelete('cascade');
$table->foreign('team_id')
->references('id')
->on(\Config::get('teamwork.teams_table'))
->onDelete('cascade');
});
Schema::create(\Config::get('teamwork.team_invites_table'), function (Blueprint $table) {
$table->increments('id');
$table->bigInteger('user_id')->unsigned();
$table->integer('team_id')->unsigned();
$table->enum('type', ['invite', 'request']);
$table->string('email');
$table->string('accept_token');
$table->string('deny_token');
$table->timestamps();
$table->foreign('team_id')
->references('id')
->on(\Config::get('teamwork.teams_table'))
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table(\Config::get('teamwork.users_table'), function (Blueprint $table) {
$table->dropColumn('current_team_id');
});
Schema::table(\Config::get('teamwork.team_user_table'), function (Blueprint $table) {
if (DB::getDriverName() !== 'sqlite') {
$table->dropForeign(\Config::get('teamwork.team_user_table').'_user_id_foreign');
}
if (DB::getDriverName() !== 'sqlite') {
$table->dropForeign(\Config::get('teamwork.team_user_table').'_team_id_foreign');
}
});
Schema::drop(\Config::get('teamwork.team_user_table'));
Schema::drop(\Config::get('teamwork.team_invites_table'));
Schema::drop(\Config::get('teamwork.teams_table'));
}
}