Skip to content

Commit

Permalink
pkp#8933 Fix migration errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy-1 committed May 20, 2023
1 parent 5ff9333 commit 7c43f3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion classes/migration/upgrade/v3_4_0/I8933_EventLogLocalized.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ public function up(): void

// Events can be triggered without a user, e.g., in schedule tasks
Schema::table('event_log', function (Blueprint $table) {
$table->dropForeign('event_log_user_id_foreign');
$table->dropIndex('event_log_user_id');
$table->bigInteger('user_id')->nullable()->change();
$table->foreign('user_id')->references('user_id')->on('users')->onDelete('cascade');
$table->index(['user_id'], 'event_log_user_id');
});

Expand Down Expand Up @@ -161,8 +163,10 @@ protected function isEventTypeToMigrateFileName(string $typeToCheck): bool
*/
protected function renameSettings()
{
$eventTypes = $this->mapSettings()->keys()->toArray();
DB::table('event_log')
->whereIn('event_type', [$this->mapSettings()->keys()->all()])
->whereIn('event_type', $eventTypes)
->orderBy('date_logged')
->each(function (object $row) {

// resolve conflict between 'name' and 'originalFileName'
Expand Down

0 comments on commit 7c43f3f

Please sign in to comment.