General Error 1025 Error On Rename Of
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with
General Error: 1025 Error On Rename Of Laravel
us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow error 1025 (hy000) error on rename of (errno 152) Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up mysql error 1025 errno 150 Help with: ERROR 1025 (HY000): Error on rename of … (errno: 150) up vote 35 down vote favorite 7 I am getting this error when I am trying to run an alter table command to drop a column: ERROR 1025 (HY000): Error
Error 1025 Outlook Mac
on rename of .... (errno: 150). If I understand correctly it is a foreign key problem, but I do not have a clue how to fix it. Would somebody be so kind and tell me how to get it working. The code used for creating table: CREATE TABLE categories( cid INT AUTO_INCREMENT NOT NULL PRIMARY KEY, assets_id INT NOT NULL, cat_name VARCHAR(30) NOT NULL, INDEX(assets_id), FOREIGN KEY (assets_id) REFERENCES asset(aid) ON UPDATE CASCADE ) ENGINE=INNODB DEFAULT CHARSET=utf8; The alter command: ALTER TABLE categories DROP
Laravel Drop Foreign Key
COLUMN assets_id; The table categories is completely blank. So there is no information to set off the CASCADE restrictions. So could you help me what kind of wizardry do I need to delete the column assets_id. Thank you. mysql share|improve this question edited May 10 '11 at 10:50 Manoj 3,42564364 asked May 10 '11 at 10:31 Henkka 3623817 add a comment| 3 Answers 3 active oldest votes up vote 66 down vote accepted Use SHOW CREATE TABLE categories to show the name of constraint. Most probably it will be categories_ibfk_1 Use the name to drop the foreign key first and the column then: ALTER TABLE categories DROP FOREIGN KEY categories_ibfk_1; ALTER TABLE categories DROP COLUMN assets_id; share|improve this answer answered May 10 '11 at 10:37 Quassnoi 262k50432484 Thank you! That did the trick. –Henkka May 10 '11 at 11:27 1 @Henkka: my pleasure. Please mark the answer as accepted (and do this for the other questions you asked too), this will encourage people to help you more. –Quassnoi May 10 '11 at 11:29 How can I mark them accepted? –Henkka May 10 '11 at 11:38 @Henkka: there is a check mark under the number of votes left to each answer. Click it so that it becomes green. –Quassnoi May 10 '11 at 11:40 Ok, thanks again. –Henkka May 10 '11 at 11:41 add a comment| up vote 0 down vote For me the problem was a different one: The site
here for a quick overview of the site Help Center Detailed answers to any questions you might have laravel drop foreign key if exists Meta Discuss the workings and policies of this site About Us Learn
Error Code 1025 Outlook Mac
more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us laravel 5 migration drop foreign key Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like http://stackoverflow.com/questions/5948704/help-with-error-1025-hy000-error-on-rename-of-errno-150 you, helping each other. Join them; it only takes a minute: Sign up Dropping column with foreign key Laravel error: General error: 1025 Error on rename up vote 26 down vote favorite 3 I've created a table using migration like this: public function up() { Schema::create('despatch_discrepancies', function($table) { $table->increments('id')->unsigned(); $table->integer('pick_id')->unsigned(); $table->foreign('pick_id')->references('id')->on('picks'); $table->integer('pick_detail_id')->unsigned(); $table->foreign('pick_detail_id')->references('id')->on('pick_details'); $table->integer('original_qty')->unsigned(); $table->integer('shipped_qty')->unsigned(); }); http://stackoverflow.com/questions/27175808/dropping-column-with-foreign-key-laravel-error-general-error-1025-error-on-ren } public function down() { Schema::drop('despatch_discrepancies'); } I need to change this table and drop the foreign key reference & column pick_detail_id and add a new varchar column called sku after pick_id column. So, I've created another migration, which looks like this: public function up() { Schema::table('despatch_discrepancies', function($table) { $table->dropForeign('pick_detail_id'); $table->dropColumn('pick_detail_id'); $table->string('sku', 20)->after('pick_id'); }); } public function down() { Schema::table('despatch_discrepancies', function($table) { $table->integer('pick_detail_id')->unsigned(); $table->foreign('pick_detail_id')->references('id')->on('pick_details'); $table->dropColumn('sku'); }); } When I run this migration, I get the following error: [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1025 Error on rename of './dev_iwms_reboot/despatch_discrepancies' to './dev_iwms_reboot/#sql2-67c-17c464' (errno: 152) (SQL: alter table despatch_discrepancies drop foreign key pick_detail_id) [PDOException] SQLSTATE[HY000]: General error: 1025 Error on rename of './dev_iwms_reboot/despatch_discrepancies' to './dev_iwms_reboot/#sql2-67c-17c464' (errno: 152) When I try to reverse this migration by running php artisan migrate:rollback command, I get a Rolled back message, but it's not actually doing anything in the database. Any idea what might be wrong? How do you drop a column that has a foreign key reference? php laravel laravel-4 database-migration share|improve this question asked No
Local Community Meetups Laravel.io Site and https://bugs.mysql.com/bug.php?id=14347 Community Forum Database migrate:reset erring when dropping foreign key I'm having an issue when error 1025 rolling back a migration that drops foreign keys. I'm creating the foreign keys in their own migration file to avoid any issues with the tables not being present and the error on rename migration itself works fine. However, the reset provides the following SQL error. [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1025 Error on rename of [emailprotected]/authors_books' to [emailprotected]/#sql2 20a-f4' (errno: 152) (SQL: alter table `authors_books` drop foreign key author_id) Everything seems fine. I'll include a sample migration set that I'm using to isolate the problem. I'm kind of stumped though. Could anyone offer some insight? 2014_03_22_162022_create_table_authors.php
Verified Impact on me: None Category:MySQL Server: Parser Severity:S2 (Serious) Version:5.0.15, 5.0.74, 5.1.30, 6.0.9 OS:Linux (Linux Suse 10, Windows) Assigned to: Tags: foreign key, innodb Triage: Triaged: D5 (Feature request) View Add Comment Files Developer Edit Submission View Progress Log Contributions [26 Oct 2005 18:53] Vadim Tkachenko Description: When I try ALTER TABLE ORDERS DROP FOREIGN KEY CUSTOMERID; I got: ERROR 1025 (HY000): Error on rename of './TESTDB/ORDERS' to './TESTDB/#sql2-3b5b-8' (errno: 152) But I only want to remove FOREIGN KEY and I don't delete any rows. How to repeat: DROP TABLE IF EXISTS `ORDERS`; CREATE TABLE `ORDERS` ( `ORDERID` int(11) NOT NULL auto_increment, `ORDERDATE` date NOT NULL, `CUSTOMERID` int(11) default NULL, `NETAMOUNT` decimal(12,2) NOT NULL, `TAX` decimal(12,2) NOT NULL, `TOTALAMOUNT` decimal(12,2) NOT NULL, PRIMARY KEY (`ORDERID`), KEY `IX_ORDER_CUSTID` (`CUSTOMERID`), CONSTRAINT `FK_CUSTOMERID` FOREIGN KEY (`CUSTOMERID`) REFERENCES `CUSTOMERS` (`CUSTOMERID`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS `CUSTOMERS`; CREATE TABLE `CUSTOMERS` ( `CUSTOMERID` int(11) NOT NULL auto_increment, `FIRSTNAME` varchar(50) NOT NULL, `LASTNAME` varchar(50) NOT NULL, `ADDRESS1` varchar(50) NOT NULL, `ADDRESS2` varchar(50) default NULL, `CITY` varchar(50) NOT NULL, `STATE` varchar(50) default NULL, `ZIP` int(11) default NULL, `COUNTRY` varchar(50) NOT NULL, `REGION` tinyint(4) NOT NULL, `EMAIL` varchar(50) default NULL, `PHONE` varchar(50) default NULL, `CREDITCARDTYPE` int(11) NOT NULL, `CREDITCARD` varchar(50) NOT NULL, `CREDITCARDEXPIRATION` varchar(50) NOT NULL, `USERNAME` varchar(50) NOT NULL, `PASSWORD` varchar(50) NOT NULL, `AGE` tinyint(4) default NULL, `INCOME` int(11) default NULL, `GENDER` varchar(1) default NULL, PRIMARY KEY (`CUSTOMERID`), UNIQUE KEY `IX_CUST_USERNAME` (`USERNAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `CUSTOMERS` VALUES (1,'VKUUXF','ITHOMQJNYX','4608499546 Dell Way','','QSDPAGD','SD',24101,'US',1,'ITHOMQJNYX@dell.com',' 4608499546',1,'1979279217775911','2012/03','user1','password',55,100000,'M'),(2,'HQNMZH','UNUKXHJVXB','5119315633 Dell Way','','YNCE RXJ','AZ',11802,'US',1,'UNUKXHJVXB@dell.com','5119315633',1,'3144519586581737','2012/11','user2','password',80,40000,'M'); INSERT INTO `ORDERS` VALUES (10677,'2004-11-10',2,'5.08','0.42','5.50'); ALTER TABLE ORDERS DROP FORE