-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dreamfactorysoftware/remove-old-api-bitbucket
Remove bitbucked service for deprecated Bitbucket API
- Loading branch information
Showing
11 changed files
with
242 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
database/migrations/2019_07_26_110740_rename_service_type_from_bitbucket2_to_bitbucket.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class RenameServiceTypeFromBitbucket2ToBitbucket extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
DB::table('service')->where('service.type', '=', 'bitbucket2') | ||
->update(['service.type' => 'bitbucket']); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
DB::table('service')->where('service.type', '=', 'bitbucket') | ||
->update(['service.type' => 'bitbucket2']); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
.../2019_07_26_110748_move_data_from_bitbucket2_config_table_into_bitbucket_config_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class MoveDataFromBitbucket2ConfigTableIntoBitbucketConfigTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
$bitbucket2_config_data = DB::table("bitbucket2_config")->get(); | ||
foreach($bitbucket2_config_data as $bitbucket_record){ | ||
if (!(DB::table('bitbucket_config')->where('service_id', '=', $bitbucket_record->service_id)->get()->count() > 0)) { | ||
DB::table('bitbucket_config')->insert([ | ||
'service_id' => $bitbucket_record->service_id, | ||
'vendor' => $bitbucket_record->vendor, | ||
'username' => $bitbucket_record->username, | ||
'password' => $bitbucket_record->password, | ||
'token' => $bitbucket_record->token, | ||
]); | ||
} | ||
} | ||
DB::table("bitbucket2_config")->delete(); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
$bitbucket_config_data = DB::table("bitbucket_config")->get(); | ||
foreach($bitbucket_config_data as $bitbucket_record){ | ||
if(!(DB::table('bitbucket2_config')->where('service_id', '=', $bitbucket_record->service_id)->get()->count() > 0)){ | ||
DB::table('bitbucket2_config')->insert([ | ||
'service_id' => $bitbucket_record->service_id, | ||
'vendor' => $bitbucket_record->vendor, | ||
'username' => $bitbucket_record->username, | ||
'password' => $bitbucket_record->password, | ||
'token' => $bitbucket_record->token, | ||
]); | ||
} | ||
} | ||
DB::table("bitbucket_config")->delete(); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
database/migrations/2019_07_26_113359_remove_bitbucket2_config_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class RemoveBitbucket2ConfigTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::dropIfExists('bitbucket2_config'); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::create( | ||
'bitbucket2_config', | ||
function (Blueprint $t) { | ||
$t->integer('service_id')->unsigned()->primary(); | ||
$t->foreign('service_id')->references('id')->on('service')->onDelete('cascade'); | ||
$t->string('vendor'); | ||
$t->string('username')->nullable(); | ||
$t->text('password')->nullable(); | ||
$t->text('token')->nullable(); | ||
} | ||
); | ||
} | ||
} |
Oops, something went wrong.