This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
How to remove column from existing table? I have tried to change, for example in create_posts_table.php, I removed column 'author'. But, when I refresh the plugin using plugin:refresh, the existing rows has gone. How to remove column and hold the existing rows?
Thanks,
1.) Create a new, custom plugin.
2.) In the updates
folder, go ahead and create a new migration file. The up()
method should remove the column, for example via the following call:
Schema::table('ranlab_blog_posts', function($table)
{
$table->dropColumn('author');
});
The down()
method should add the author column back.
3.) List this file in the version.yaml
Another note: If you are using the RainLab.Blog
plugin, make sure you are using the latest version. There is no author column since quite a long time now ;)
Last updated
1-2 of 2