Welcome Guest, Not a member yet? Register   Sign In
DB Forge Can't DROP 'table_name'; check that column/key exists
#1

(This post was last modified: 04-11-2016, 11:12 PM by Human Fly. Edit Reason: Enter code into code block )

I'm up against a weird issue here in version 3.0.6 that I still can't figure out despite hacking away at the DB_forge class trying to make sense of what's wrong.

Decided to implement migrations and have had mixed results. Stumped with this right now:

Created a new migration class:


Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_paragraph_image extends CI_Migration
{

   public function up()
   {
       $this->load->dbforge();
       if($this->db->field_exists('caption', 'paragraph_image'))
       {
           $this->dbforge->drop_column('paragraph_image', 'caption');
       }
   }
}



When the migration runs I get this:

A Database Error Occurred
Error Number: 1091
Can't DROP 'caption'; check that column/key exists
ALTER TABLE `paragraph_image` DROP COLUMN `caption`
Filename: migrations/20160412120700_paragraph_image.php
Line Number: 11


The field is actually removed from the table as hoped so the query itself is sound, but the error is thrown regardless and is the same for any field name and table. The query itself is executed on line 615 of system/database/DB_forge.php.

Anyone come across this one and more importantly know how to fix it?

Thank you.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB