mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Back in time fix FOR #7145 for new installs on MySQL 8+
This commit is contained in:
parent
30904dd019
commit
2bfa05fd2d
|
@ -29,7 +29,7 @@ class MigrationCartalystSentryInstallGroups extends Migration {
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('groups', function($table)
|
Schema::create('permission_groups', function($table)
|
||||||
{
|
{
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
@ -46,7 +46,7 @@ class MigrationCartalystSentryInstallGroups extends Migration {
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::drop('groups');
|
Schema::drop('permission_groups');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,23 @@ class RenameGroupsTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
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');
|
Schema::rename('groups', 'permission_groups');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
*
|
||||||
|
@ -23,6 +37,8 @@ class RenameGroupsTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
|
if (Schema::hasTable('permission_groups')) {
|
||||||
Schema::rename('permission_groups', 'groups');
|
Schema::rename('permission_groups', 'groups');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue