J'ai crée un plugin avec une migration. Mon version.yaml estComment annuler la migration du plug-in dans OctoberCMS?
1.0.1: First version of user
1.0.2:
- Added new fields to User model
- alter_table_users_add_contact_fields.php
Ma mises à jour contient un fichier de migration alter_table_users_add_contact_fields.php
.
<?php
namespace Mnv\Reminder\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class CreateTableNewsRead extends Migration
{
protected $table = 'mnv_news_read';
public function up()
{
Schema::create($this->table, function($table)
{
$table->engine = 'InnoDB';
$table->increments('id');
$table->integer('news_id');
$table->foreign('news_id')->references('id')->on('rainlab_blog_posts')->onUpdate('cascade')->onDelete('cascade');
$table->integer('user_id');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
$table->timestamp('read_at');
$table->index([
'news_id',
'user_id',
]);
$table->index([
'user_id',
'news_id',
]);
});
}
public function down()
{
Schema::dropIfExists($this->table);
}
}
I a couru avec succès cette migration en utilisant la commande de la console php artisan october:up
.
Mais maintenant je veux annuler cette migration. Comme je vois, il n'y a pas d'information sur cette migration dans la table migrations
. Donc, je ne peux pas restaurer cette commande usins de migration php artisan migrate:rollback
.
J'ai trouvé que les informations sur la version du plugin se trouvent dans le tableau system_plugin_versions
. J'ai supprimé manuellement ma table mnv_news_read
et supprimé manuellement les enregistrements correspondants des tables system_plugin_versions
et system_plugin_history
.
drop table mnv_news_read;
delete from system_plugin_history where code = 'Mnv.Reminder';
delete from system_plugin_versions where code = 'Mnv.Reminder';
Après que je tryed courir php artisan october:up
à nouveau. Il s'est terminé avec succès.
Ma question est de savoir comment restaurer la migration du plugin correctement?