Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/migration dropouts #351

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
<?php

class AdminAddMigrationMessageTextColumns extends CmfiveMigration {
class AdminAddMigrationMessageTextColumns extends CmfiveMigration
{

public function up() {
$this->addColumnToTable('migration', 'pretext', 'string', ['default' => null, 'null' => true]);
$this->addColumnToTable('migration', 'posttext', 'string', ['default' => null, 'null' => true]);
$this->addColumnToTable('migration', 'description', 'string', ['default' => null, 'null' => true]);
public function up()
{

if ($this->hasTable('migration') && !$this->table("migration")->hasColumn("pretext")) {
$this->addColumnToTable('migration', 'pretext', 'string', ['default' => null, 'null' => true]);
$this->addColumnToTable('migration', 'posttext', 'string', ['default' => null, 'null' => true]);
$this->addColumnToTable('migration', 'description', 'string', ['default' => null, 'null' => true]);
}
}

public function down() {
$this->removeColumnFromTable('migration', 'pretext');
$this->removeColumnFromTable('migration', 'posttext');
$this->removeColumnFromTable('migration', 'description');
public function down()
{
if ($this->hasTable('migration') && $this->table("migration")->hasColumn("pretext")) {
$this->removeColumnFromTable('migration', 'pretext');
$this->removeColumnFromTable('migration', 'posttext');
$this->removeColumnFromTable('migration', 'description');
}
}

public function preText() {
public function preText()
{
return "";
}

public function postText() {
public function postText()
{
return "";
}

public function description() {
public function description()
{
return "";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Removes the inbox table from the Inbox module that is no longer used or supported.
*/
Expand All @@ -12,15 +13,16 @@ public function up(): void
$this->dropTable('inbox_message');

//Clear out the related user roles
$this->w->db->delete('user_role')->where('role', 'inbox_sender')->execute();
$this->w->db->delete('user_role')->where('role', 'inbox_reader')->execute();
if ($this->hasTable('user_role')) {
$this->w->db->delete('user_role')->where('role', 'inbox_sender')->execute();
$this->w->db->delete('user_role')->where('role', 'inbox_reader')->execute();
}
}

public function down(): void
{
}
public function down(): void {}

public function description() {
public function description()
{
return 'Remove inbox table and roles';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

class AdminStableMigrationSchema extends CmfiveMigration
{

public function up()
{
$this->addColumnToTable('migration', 'pretext', 'string', ['default' => null, 'null' => true]);
$this->addColumnToTable('migration', 'posttext', 'string', ['default' => null, 'null' => true]);
$this->addColumnToTable('migration', 'description', 'string', ['default' => null, 'null' => true]);
}

public function down()
{
$this->removeColumnFromTable('migration', 'pretext');
$this->removeColumnFromTable('migration', 'posttext');
$this->removeColumnFromTable('migration', 'description');
}

public function preText()
{
return "";
}

public function postText()
{
return "";
}

public function description()
{
return "";
}
}
3 changes: 2 additions & 1 deletion system/modules/admin/models/MigrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ public function installInitialMigration()
{
$filenames = [
"AdminInitialMigration" => "20151030134124-AdminInitialMigration.php",
"AdminMigrationSeed" => "20170123091600-AdminMigrationSeed.php"
"AdminMigrationSeed" => "20170123091600-AdminMigrationSeed.php",
"AdminStableMigrationSchema" => "20240911010101-AdminStableMigrationSchema.php",
];

$directory = SYSTEM_MODULE_DIRECTORY . DS . "admin" . DS . MIGRATION_DIRECTORY;
Expand Down
Loading