This commit is contained in:
Ludovic CANDELLIER
2022-04-13 23:49:48 +02:00
parent 8afb3467f8
commit 2f77b5fc23
56 changed files with 948 additions and 336 deletions

View File

@@ -15,13 +15,14 @@ class CreateShopCustomersTable extends Migration {
Schema::create('shop_customers', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 50)->default('0');
$table->string('address1', 50)->default('0');
$table->string('address2', 50)->default('0');
$table->string('zipcode', 50)->default('0');
$table->string('city', 50)->default('0');
$table->string('country', 50)->default('0');
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->string('email')->unique();
$table->dateTime('email_verified_at')->nullable();
$table->string('password');
$table->string('remember_token', 100)->nullable();
$table->timestamps();
$table->softDeletes();
});
}

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'));
}
}