Skip to content

Commit b565185

Browse files
author
Luca Degasperi
committed
Improved the migration's rollback by dropping foreign indexes first
1 parent 378333b commit b565185

11 files changed

+41
-0
lines changed

src/migrations/2013_07_24_133032_create_oauth_client_endpoints_table.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public function up()
3535
*/
3636
public function down()
3737
{
38+
Schema::table('oauth_client_endpoints', function ($table) {
39+
$table->dropForeign('oauth_client_endpoints_client_id_foreign');
40+
});
41+
3842
Schema::drop('oauth_client_endpoints');
3943
}
4044
}

src/migrations/2013_07_24_133359_create_oauth_sessions_table.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public function up()
3636
*/
3737
public function down()
3838
{
39+
Schema::table('oauth_sessions', function ($table) {
40+
$table->dropForeign('oauth_sessions_client_id_foreign');
41+
});
42+
3943
Schema::drop('oauth_sessions');
4044
}
4145
}

src/migrations/2013_07_24_133833_create_oauth_session_access_tokens_table.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public function up()
3939
*/
4040
public function down()
4141
{
42+
Schema::table('oauth_session_access_tokens', function ($table) {
43+
$table->dropForeign('oauth_session_access_tokens_session_id_foreign');
44+
});
4245
Schema::drop('oauth_session_access_tokens');
4346
}
4447
}

src/migrations/2013_07_24_134209_create_oauth_session_authcodes_table.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public function up()
3737
*/
3838
public function down()
3939
{
40+
Schema::table('oauth_session_authcodes', function ($table) {
41+
$table->dropForeign('oauth_session_authcodes_session_id_foreign');
42+
});
4043
Schema::drop('oauth_session_authcodes');
4144
}
4245
}

src/migrations/2013_07_24_134437_create_oauth_session_redirects_table.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public function up()
3636
*/
3737
public function down()
3838
{
39+
Schema::table('oauth_session_redirects', function ($table) {
40+
$table->dropForeign('oauth_session_redirects_session_id_foreign');
41+
});
3942
Schema::drop('oauth_session_redirects');
4043
}
4144
}

src/migrations/2013_07_24_134700_create_oauth_session_refresh_tokens_table.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public function up()
4444
*/
4545
public function down()
4646
{
47+
Schema::table('oauth_session_refresh_tokens', function ($table) {
48+
$table->dropForeign('oauth_session_refresh_tokens_client_id_foreign');
49+
$table->dropForeign('oauth_session_refresh_tokens_session_access_token_id_foreign');
50+
});
4751
Schema::drop('oauth_session_refresh_tokens');
4852
}
4953
}

src/migrations/2013_07_24_135250_create_oauth_session_token_scopes_table.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public function up()
4444
*/
4545
public function down()
4646
{
47+
Schema::table('oauth_session_token_scopes', function ($table) {
48+
$table->dropForeign('oauth_session_token_scopes_scope_id_foreign');
49+
$table->dropForeign('oauth_session_token_scopes_session_access_token_id_foreign');
50+
});
4751
Schema::drop('oauth_session_token_scopes');
4852
}
4953
}

src/migrations/2013_07_24_135634_create_oauth_session_authcode_scopes_table.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public function up()
4040
*/
4141
public function down()
4242
{
43+
Schema::table('oauth_session_authcode_scopes', function ($table) {
44+
$table->dropForeign('oauth_session_authcode_scopes_scope_id_foreign');
45+
$table->dropForeign('oauth_session_authcode_scopes_oauth_session_authcode_id_foreign');
46+
});
4347
Schema::drop('oauth_session_authcode_scopes');
4448
}
4549
}

src/migrations/2013_08_07_112252_create_oauth_client_grants_table.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public function up()
3737
*/
3838
public function down()
3939
{
40+
Schema::table('oauth_client_grants', function ($table) {
41+
$table->dropForeign('oauth_client_grants_client_id_foreign');
42+
$table->dropForeign('oauth_client_grants_grant_id_foreign');
43+
});
4044
Schema::drop('oauth_client_grants');
4145
}
4246
}

src/migrations/2013_08_07_183251_create_oauth_client_scopes_table.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public function up()
3737
*/
3838
public function down()
3939
{
40+
Schema::table('oauth_client_scopes', function ($table) {
41+
$table->dropForeign('oauth_client_scopes_client_id_foreign');
42+
$table->dropForeign('oauth_client_scopes_scope_id_foreign');
43+
});
4044
Schema::drop('oauth_client_scopes');
4145
}
4246
}

0 commit comments

Comments
 (0)