-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/historic-update-requests (#254)
* Added new export without actioning_user * Update 2019_09_16_092204_add_historic_update_requests_to_report_types_table.php * Update ERD.mwb * Added actioning_user_id column migration * Updated API docs * Added logic for storing actioning user * Added actioning user to report * Expecting nullable users for update request report
- Loading branch information
1 parent
5a5dcda
commit e514e04
Showing
14 changed files
with
353 additions
and
25 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
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
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
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
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
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
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
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
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
Binary file not shown.
50 changes: 50 additions & 0 deletions
50
database/migrations/2019_09_16_092204_add_historic_update_requests_to_report_types_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,50 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Support\Facades\Date; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class AddHistoricUpdateRequestsToReportTypesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up() | ||
{ | ||
$now = Date::now(); | ||
|
||
DB::table('report_types')->insert([ | ||
'id' => uuid(), | ||
'name' => 'Historic Update Requests Export', | ||
'created_at' => $now, | ||
'updated_at' => $now, | ||
]); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down() | ||
{ | ||
$reportType = DB::table('report_types') | ||
->where('name', '=', 'Historic Update Requests Export') | ||
->first(); | ||
|
||
$fileIds = DB::table('reports') | ||
->where('report_type_id', '=', $reportType->id) | ||
->pluck('file_id') | ||
->toArray(); | ||
|
||
DB::table('files') | ||
->whereIn('id', $fileIds) | ||
->delete(); | ||
|
||
DB::table('reports') | ||
->where('report_type_id', '=', $reportType->id) | ||
->delete(); | ||
|
||
DB::table('report_types') | ||
->where('name', '=', 'Historic Update Requests Export') | ||
->delete(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...se/migrations/2019_09_16_122934_add_actioning_user_id_column_to_update_requests_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,30 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddActioningUserIdColumnToUpdateRequestsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('update_requests', function (Blueprint $table) { | ||
$table->uuid('actioning_user_id')->nullable()->after('user_id'); | ||
$table->foreign('actioning_user_id')->references('id')->on('users'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('update_requests', function (Blueprint $table) { | ||
$table->dropForeign(['actioning_user_id']); | ||
$table->dropColumn('actioning_user_id'); | ||
}); | ||
} | ||
} |
Oops, something went wrong.