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

Can not reinstall the plugin if missing columns with a prefix seo_ #8

Open
iammartinbelobrad opened this issue Feb 19, 2015 · 1 comment

Comments

@iammartinbelobrad
Copy link

eg.:

[Illuminate\Database\QueryException]                                                                                 
  SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'seo_title'; check that column/key exists (SQL:   
  alter table `rainlab_blog_posts` drop `seo_title`)
@tonyputi
Copy link

Here the solution. You need to replace the migration file inside plugin with this!

<?php namespace AnandPatel\SeoExtension\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;
use System\Classes\PluginManager;
class CreateBlogPostsTable extends Migration
{

    public function up()
    {
        if(PluginManager::instance()->hasPlugin('RainLab.Blog'))
        {
            Schema::table('rainlab_blog_posts', function($table)
            {
                $table->string('seo_title')->nullable();
                $table->string('seo_description')->nullable();
                $table->string('seo_keywords')->nullable();
                $table->string('canonical_url')->nullable();
                $table->string('redirect_url')->nullable();
                $table->string('robot_index')->nullable();
                $table->string('robot_follow')->nullable();
            });
        }
    }

    public function down()
    {
        if(PluginManager::instance()->hasPlugin('RainLab.Blog'))
        {
            Schema::table('rainlab_blog_posts', function($table)
            {
				$table->dropColumn(['seo_title', 'seo_description', 'seo_keywords', 'canonical_url', 'redirect_url', 'robot_index', 'robot_follow']);
  
            });
        }

    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants