Yiiscrapermodule Database Error (Assumed Foreign Key Error)?


(Irufan) #1

Here is the sql statement that was supposed to be run, somehow the tables were created but it gets stuck at the foriegn key part im guessing? because i checked the error code and it says something about the table’s data types/ columns mismatch… can anyone help me figure out what was wrong with it?

SQL statement executed was: CREATE TABLE yiiscraper_related_data (

link_id_from int(11) unsigned NOT NULL,

link_id_to int(11) unsigned NOT NULL,

PRIMARY KEY (link_id_from,link_id_to),

UNIQUE KEY link_id_to (link_id_to,link_id_from),

CONSTRAINT tbl_yiiscraper_related_data_ibfk_1 FOREIGN KEY (link_id_from) REFERENCES tbl_yiiscraper_link (id) ON DELETE CASCADE,

CONSTRAINT tbl_yiiscraper_related_data_ibfk_2 FOREIGN KEY (link_id_to) REFERENCES tbl_yiiscraper_link (id) ON DELETE CASCADE

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=‘Table to handle relations of links’


(Jescor) #2

I’m also getting similar error on install below. Anyone have any ideas?

CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1005 Can’t create table ‘yii_rk_instafire.yiiscraper_related_data’ (errno: 150). The SQL statement executed was: CREATE TABLE yiiscraper_related_data (

link_id_from int(11) unsigned NOT NULL,

link_id_to int(11) unsigned NOT NULL,

PRIMARY KEY (link_id_from,link_id_to),

UNIQUE KEY link_id_to (link_id_to,link_id_from),

CONSTRAINT tbl_yiiscraper_related_data_ibfk_1 FOREIGN KEY (link_id_from) REFERENCES tbl_yiiscraper_link (id) ON DELETE CASCADE,

CONSTRAINT tbl_yiiscraper_related_data_ibfk_2 FOREIGN KEY (link_id_to) REFERENCES tbl_yiiscraper_link (id) ON DELETE CASCADE

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=‘Table to handle relations of links’


(Jescor) #3

Okay, here is the solution near the bottom of the extension page: http://www.yiiframework.com/extension/yiiscrapermodule/

And it does work. I reran the install and got this message, "itOK: installed"

And now that table is in my database :D

aquasite.pl at 2013/01/15 05:46am

Install Error

Hi, Thanks for extension. You forgot to add prefix in Installer sql query on line 55 and 56.

It’s: tbl_yiiscraper_link Should be: {$prefix}yiiscraper_link


(Da:Sourcerer) #4

Well, let’s check the obvious:

  • Does the table [font="Courier New"]tbl_yiiscraper_link[/font] really exist?

  • Is the field [font="Courier New"]tbl_yiiscraper_link.id[/font] exactly of the type [font="Courier New"]int(11) unsigned NOT NULL[/font]?

Also: http://stackoverflow.com/q/8070336/3012385

Edit: Ah, there you go ::)