-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
51 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace superbig\reports\migrations; | ||
|
||
use Craft; | ||
use craft\db\Migration; | ||
use craft\db\mysql\ColumnSchema; | ||
use superbig\reports\records\ReportsTargetsRecord; | ||
|
||
require_once __DIR__ . '/m190305_191905_add_targets_reports_relationship.php'; | ||
|
||
/** | ||
* m190306_140704_fix_double_table migration. | ||
*/ | ||
class m190306_140704_fix_double_table extends Migration | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeUp() | ||
{ | ||
$tableSchema = Craft::$app->db->schema->getTableSchema(ReportsTargetsRecord::tableName()); | ||
if ($tableSchema !== null) { | ||
if (isset($tableSchema->columns['dateLastRun'])) { | ||
$migration = new m190305_191905_add_targets_reports_relationship(); | ||
|
||
$this->dropTableIfExists(ReportsTargetsRecord::tableName()); | ||
$migration->safeUp(); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeDown() | ||
{ | ||
echo "m190306_140704_fix_double_table cannot be reverted.\n"; | ||
|
||
return false; | ||
} | ||
} |