Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migrations with dependencies failing if run by themselves #10461

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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