mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-15 01:54:09 -08:00
934afa036f
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions. You may customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config file to your project root. Feel free to use [Shift's Laravel ruleset][2] to help you get started. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class RenameGroupsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
// We check to see if this table exists before attempting the migration since
|
|
// upgraded installs would have this table, but new installs wouldn't.
|
|
// We had to change the name of the table in the older migrations
|
|
// to handle a MySQl 8+ compatibility issue related to reserved words.
|
|
// Without going back in time in migrations, this would fail since the groups table
|
|
// would never be allowed to be created in the first place on MySql 8+.
|
|
//
|
|
// So... if an upgrade, let's rename that table.
|
|
// If a new install, the migration was already changed, so the table isn't
|
|
// called that anymore and we can skip this migration.
|
|
|
|
if (Schema::hasTable('groups')) {
|
|
Schema::rename('groups', 'permission_groups');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
if (Schema::hasTable('permission_groups')) {
|
|
Schema::rename('permission_groups', 'groups');
|
|
}
|
|
}
|
|
}
|