Skip to content

Commit

Permalink
updated migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Cappiello committed Apr 2, 2018
1 parent 266cfc9 commit f155ed8
Show file tree
Hide file tree
Showing 24 changed files with 1,104 additions and 1,091 deletions.
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"authors": [
{
"name": "juliatzin",
"email": "xoco70@hotmail.com"
"email": "xoco77777@gmail.com"
}
],
"autoload": {
Expand Down Expand Up @@ -37,18 +37,18 @@
},

"require": {
"php": ">=7.0.0",
"php": ">=7.1.0",
"kalnoy/nestedset": "^4.3"
},
"scripts": {
"test": "phpunit"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"phpunit/phpunit": "^7.0",
"fzaninotto/faker": "1.*",
"laravel/browser-kit-testing": "^2.0",
"orchestra/testbench-browser-kit": "~3.5",
"orchestra/database": "~3.1",
"symfony/var-dumper": "~3.3.6"
"laravel/browser-kit-testing": "^4.0",
"orchestra/testbench-browser-kit": "~3.6",
"orchestra/database": "~3.6",
"symfony/var-dumper": "~4.0"
}
}
1,091 changes: 582 additions & 509 deletions composer.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ class CreateLtUsersTable extends Migration
*/
public function up()
{
if (!Schema::hasTable('users')) {
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('firstname')->default('firstname');
$table->string('lastname')->default('lastname');
$table->string('email')->unique();
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});
}


/**
* Reverse the migrations.
*
Expand Down

This file was deleted.

39 changes: 39 additions & 0 deletions database/migrations/2014_11_01_171758_create_lt_Venue_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateLtVenueTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('venue', function (Blueprint $table) {
$table->increments('id');
$table->string('venue_name');
$table->string('address')->nullable();
$table->string('details')->nullable();
$table->string('city')->nullable();
$table->string('CP')->nullable();
$table->string('state')->nullable();
$table->string('latitude')->nullable();
$table->string('longitude')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('venue');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Carbon;
use Xoco70\LaravelTournaments\DBHelpers;

class CreateLtTournamentTable extends Migration
{
public function up()
{
Schema::create('tournament', function (Blueprint $table) {
$table->increments('id');
//TODO Added ->nullable() to solve FK issue with Sqlite :(
$table->Integer('user_id')->unsigned()->nullable()->index();
$table->foreign('user_id')
->references('id')
->on('users')
->onUpdate('cascade')
->onDelete('cascade');

$table->string('name');
$table->string('slug')->unique();
$table->date('dateIni');
$table->date('dateFin');
$table->date('registerDateLimit')->nullable()->default(Carbon::now()->addMonth(1));
$table->integer('sport')->unsigned()->default(1);
$table->string('promoter')->nullable();
$table->string('host_organization')->nullable();
$table->string('technical_assistance')->nullable();
$table->integer('rule_id')->default(1);
$table->tinyInteger('type')->default(1); // 1= local, 2= state, 3= national, 4=continent, 5=world
$table->integer('venue_id')->nullable()->unsigned();
$table->integer("level_id")->unsigned()->nullable()->default(1); // TODO nullable ???
$table->foreign('venue_id')
->references('id')
->on('venue');

$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}

public function down()
{
DBHelpers::setFKCheckOff();
Schema::dropIfExists('tournament');
DBHelpers::setFKCheckOn();
}
}
97 changes: 97 additions & 0 deletions database/migrations/2014_12_03_230347_create_lt_Category_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Xoco70\LaravelTournaments\DBHelpers;

class CreateLtCategoryTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{

Schema::create('category', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('gender')->nullable();
$table->integer('isTeam')->unsigned()->default(0);
$table->integer('ageCategory')->unsigned()->default(0); // 0 = none, 1 = child, 2= teenager, 3 = adult, 4 = master
$table->integer('ageMin')->unsigned()->default(0);
$table->integer('ageMax')->unsigned()->default(0);
$table->integer('gradeCategory')->unsigned()->default(0);
$table->integer('gradeMin')->unsigned()->default(0);
$table->integer('gradeMax')->unsigned()->default(0);
$table->unique(['name', 'gender', 'isTeam', 'ageCategory', 'ageMin', 'ageMax', 'gradeCategory', 'gradeMin', 'gradeMax'], 'category_fields_unique');
$table->timestamps();
$table->engine = 'InnoDB';
});

Schema::create('championship', function (Blueprint $table) {
$table->increments('id');
$table->integer('tournament_id')->unsigned()->index();
$table->integer('category_id')->unsigned()->index();
$table->unique(['tournament_id', 'category_id']);

$table->foreign('tournament_id')
->references('id')
->on('tournament')
->onUpdate('cascade')
->onDelete('cascade');

$table->foreign('category_id')
->references('id')
->on('category')
->onDelete('cascade');

$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});

Schema::create('competitor', function (Blueprint $table) {
$table->increments('id');
$table->integer('short_id')->unsigned()->nullable();
$table->integer('championship_id')->unsigned()->index();
$table->foreign('championship_id')
->references('id')
->on('championship')
->onUpdate('cascade')
->onDelete('cascade');

$table->integer('user_id')->unsigned()->index();
$table->foreign('user_id')
->references('id')
->on('users')
->onUpdate('cascade')
->onDelete('cascade');

$table->unique(['championship_id', 'short_id']);
$table->unique(['championship_id', 'user_id']);

$table->boolean('confirmed');

$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});

}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DBHelpers::setFKCheckOff();
Schema::dropIfExists('competitor');
Schema::dropIfExists('championship');
Schema::dropIfExists('category');
DBHelpers::setFKCheckOn();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Xoco70\LaravelTournaments\DBHelpers;
use Xoco70\LaravelTournaments\Models\ChampionshipSettings;

class CreateLtChampionshipSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('championship_settings', function (Blueprint $table) {
$table->increments('id');
$table->string('alias')->nullable();
$table->integer('championship_id')->unsigned()->unique();
$table->foreign('championship_id')
->references('id')
->onUpdate('cascade')
->on('championship')
->onDelete('cascade');

// Category Section
$table->tinyInteger('treeType')->default(ChampionshipSettings::SINGLE_ELIMINATION);
$table->tinyInteger('fightingAreas')->unsigned()->nullable()->default(1);
$table->integer('limitByEntity')->unsigned()->nullable();

// Preliminary
$table->boolean('hasPreliminary')->default(1);
$table->boolean('preliminaryGroupSize')->default(3);
$table->tinyInteger('preliminaryWinner')->default(1); // Number of Competitors that go to next level
$table->string('preliminaryDuration')->nullable(); // Match Duration in preliminary heat

// Team
$table->tinyInteger('teamSize')->nullable(); // Default is null
$table->tinyInteger('teamReserve')->nullable(); // Default is null

// Seed
$table->smallInteger('seedQuantity')->nullable(); // Competitors seeded in tree

//TODO This should go in another table that is not for tree construction but for rules
// Rules
$table->boolean('hasEncho')->default(1);
$table->tinyInteger('enchoQty')->default(0);
$table->string('enchoDuration')->nullable();
$table->boolean('hasHantei')->default(false);
$table->smallInteger('cost')->nullable(); // Cost of competition

$table->string('fightDuration')->nullable(); // Can't apply default because text
$table->smallInteger('hanteiLimit')->default(0); // 0 = none, 1 = 1/8, 2 = 1/4, 3=1/2, 4 = FINAL
$table->smallInteger('enchoGoldPoint')->default(0); // 0 = none, 1 = 1/8, 2 = 1/4, 3=1/2, 4 = FINAL

$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DBHelpers::setFKCheckOff();
Schema::dropIfExists('championship_settings');
DBHelpers::setFKCheckOn();
}
}
Loading

0 comments on commit f155ed8

Please sign in to comment.