Skip to content

Commit

Permalink
fixed: activity log table name issue (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhupeshappfoster authored Jun 12, 2024
1 parent fa1665d commit 4b9bfd6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ protected function createTables()
[
'id' => $this->primaryKey(),
'message' => $this->text(),
'targetclass' => $this->string()->notNull(),
'targetClass' => $this->string()->notNull(),
'targetId' => $this->integer()->notNull(),
'created' => $this->dateTime()->notNull(),
'actions' => $this->text()
Expand Down
36 changes: 36 additions & 0 deletions src/migrations/m240610_142319_update_translation_activitylogs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace acclaro\translations\migrations;

use acclaro\translations\Constants;
use craft\db\Migration;

/**
* Migration to update translations_activitylogs table
*/
class m240610_142319_update_translation_activitylogs extends Migration
{
/**
* @inheritdoc
*/
public function safeUp(): bool
{
// Check if the table exists
if ($this->db->tableExists(Constants::TABLE_ACTIVITY_LOG)) {
if ($this->db->getTableSchema(Constants::TABLE_ACTIVITY_LOG)->getColumn('targetclass') !== null) {
$this->renameColumn(Constants::TABLE_ACTIVITY_LOG, 'targetclass', 'targetClass');
}
}

return true;
}

/**
* @inheritdoc
*/
public function safeDown(): bool
{
echo "m240610_142319_update_translation_activitylogs cannot be reverted.\n";
return false;
}
}

0 comments on commit 4b9bfd6

Please sign in to comment.