Skip to content

Commit

Permalink
Merge pull request #10461 from cl8n/fix-dependent-migrations
Browse files Browse the repository at this point in the history
Fix migrations with dependencies failing if run by themselves
  • Loading branch information
nanaya authored Aug 15, 2023
2 parents 09186f2 + d02ac35 commit 4453472
Show file tree
Hide file tree
Showing 29 changed files with 106 additions and 97 deletions.
9 changes: 9 additions & 0 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Models\LoginAttempt;
use Egulias\EmailValidator\EmailValidator;
use Egulias\EmailValidator\Validation\NoRFCWarningsValidation;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Arr;
use Illuminate\Support\HtmlString;

Expand Down Expand Up @@ -1847,3 +1848,11 @@ function unmix(string $resource): HtmlString
{
return app('assets-manifest')->src($resource);
}

/**
* Get an instance of the named migration.
*/
function migration(string $name): Migration
{
return require database_path("migrations/{$name}.php");
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateOsuSlackUsersTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -33,4 +33,4 @@ public function down()
{
Schema::drop('osu_slack_users');
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateBeatmapsetDiscussions extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -38,4 +38,4 @@ public function down()
{
Schema::drop('beatmapset_discussions');
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use Illuminate\Database\Migrations\Migration;

class ChangePrimaryKeyOnSlackUsers extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -32,4 +32,4 @@ public function down()
$table->primary('slack_id');
});
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use Illuminate\Database\Migrations\Migration;

class OsuSlackUserMakeSlackIdNullable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
$table->string('slack_id', 50)->change();
});
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use Illuminate\Database\Migrations\Migration;

class AddIndexOnSlackId extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -30,4 +30,4 @@ public function down()
$table->dropIndex('osu_slack_users_slack_id_index');
});
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthScopesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -44,4 +44,4 @@ public function down()
{
Schema::drop('oauth_scopes');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthGrantsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -42,4 +42,4 @@ public function down()
{
Schema::drop('oauth_grants');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthGrantScopesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -60,4 +60,4 @@ public function down()
});
Schema::drop('oauth_grant_scopes');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthClientsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -46,4 +46,4 @@ public function down()
{
Schema::drop('oauth_clients');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthClientEndpointsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -56,4 +56,4 @@ public function down()

Schema::drop('oauth_client_endpoints');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthClientScopesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -60,4 +60,4 @@ public function down()
});
Schema::drop('oauth_client_scopes');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthClientGrantsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -61,4 +61,4 @@ public function down()
});
Schema::drop('oauth_client_grants');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthSessionsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -56,4 +56,4 @@ public function down()
});
Schema::drop('oauth_sessions');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthSessionScopesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -60,4 +60,4 @@ public function down()
});
Schema::drop('oauth_session_scopes');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthAuthCodesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -55,4 +55,4 @@ public function down()
});
Schema::drop('oauth_auth_codes');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthAuthCodeScopesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -60,4 +60,4 @@ public function down()
});
Schema::drop('oauth_auth_code_scopes');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthAccessTokensTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -55,4 +55,4 @@ public function down()
});
Schema::drop('oauth_access_tokens');
}
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* This file is part of OAuth 2.0 Laravel.
*
* (c) Luca Degasperi <[email protected]>
Expand All @@ -18,7 +18,7 @@
*
* @author Luca Degasperi <[email protected]>
*/
class CreateOauthAccessTokenScopesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down Expand Up @@ -60,4 +60,4 @@ public function down()
});
Schema::drop('oauth_access_token_scopes');
}
}
};
Loading

0 comments on commit 4453472

Please sign in to comment.