| @@ 6-39 (lines=34) @@ | ||
| 3 | use Illuminate\Database\Capsule\Manager as Capsule; |
|
| 4 | use \Illuminate\Database\Schema\Blueprint as Blueprint; |
|
| 5 | ||
| 6 | class CreateCoachesTable |
|
| 7 | {
|
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function run() |
|
| 14 | {
|
|
| 15 | Capsule::schema()->dropIfExists('coaches');
|
|
| 16 | Capsule::schema()->create('coaches', function (Blueprint $table) {
|
|
| 17 | $table->increments('id');
|
|
| 18 | $table->string('name');
|
|
| 19 | $table->string('surname');
|
|
| 20 | $table->tinyInteger('age');
|
|
| 21 | $table->string('nationality',2);
|
|
| 22 | $table->float('skillAvg');
|
|
| 23 | $table->float('wageReq');
|
|
| 24 | $table->string('favouriteModule',10);
|
|
| 25 | $table->integer('team_id')->nullable();
|
|
| 26 | $table->timestamps(); |
|
| 27 | }); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * Reverse the migrations. |
|
| 32 | * |
|
| 33 | * @return void |
|
| 34 | */ |
|
| 35 | public function down() |
|
| 36 | {
|
|
| 37 | Schema::drop('coaches');
|
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| @@ 6-30 (lines=25) @@ | ||
| 3 | use Illuminate\Database\Capsule\Manager as Capsule; |
|
| 4 | use \Illuminate\Database\Schema\Blueprint as Blueprint; |
|
| 5 | ||
| 6 | class CreatePlayersTable |
|
| 7 | {
|
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function run() |
|
| 14 | {
|
|
| 15 | Capsule::schema()->dropIfExists('players');
|
|
| 16 | Capsule::schema()->create('players', function (Blueprint $table) {
|
|
| 17 | $table->increments('id');
|
|
| 18 | $table->string('name');
|
|
| 19 | $table->string('surname');
|
|
| 20 | $table->tinyInteger('age');
|
|
| 21 | $table->string('nationality',2);
|
|
| 22 | $table->float('skillAvg');
|
|
| 23 | $table->float('wageReq');
|
|
| 24 | $table->float('val');
|
|
| 25 | $table->string('role',2);
|
|
| 26 | $table->integer('team_id')->nullable();
|
|
| 27 | $table->timestamps(); |
|
| 28 | }); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||
| @@ 6-28 (lines=23) @@ | ||
| 3 | use Illuminate\Database\Capsule\Manager as Capsule; |
|
| 4 | use \Illuminate\Database\Schema\Blueprint as Blueprint; |
|
| 5 | ||
| 6 | class CreateLeagueTeamsTable |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function run() |
|
| 14 | { |
|
| 15 | Capsule::schema()->dropIfExists('league_teams'); |
|
| 16 | Capsule::schema()->create('league_teams', function (Blueprint $table) { |
|
| 17 | $table->increments('id'); |
|
| 18 | $table->integer('league_id'); |
|
| 19 | $table->integer('team_id'); |
|
| 20 | $table->unsignedTinyInteger('points')->default(0); |
|
| 21 | $table->unsignedTinyInteger('played')->default(0); |
|
| 22 | $table->unsignedTinyInteger('won')->default(0); |
|
| 23 | $table->unsignedTinyInteger('draw')->default(0); |
|
| 24 | $table->unsignedTinyInteger('lost')->default(0); |
|
| 25 | $table->timestamps(); |
|
| 26 | }); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | ||