Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion rename_column for primary key
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kartik Rustagi  
View profile  
 More options Oct 25 2012, 9:00 am
From: Kartik Rustagi <kartikrust...@gmail.com>
Date: Thu, 25 Oct 2012 06:00:22 -0700 (PDT)
Local: Thurs, Oct 25 2012 9:00 am
Subject: rename_column for primary key

Hi,

I have a table A with a column 'abc' which I want to rename to 'xyz'.
Column 'abc' being primary key. I have written the following migration to
do so:

*alter_table :A do*
*   rename_column(:abc, :xyz)*
*end*
*This migration fails with the error: ERROR 1068 (42000): Multiple primary
key defined*
*Mysql logs shows the query being: ALTER TABLE `A` CHANGE COLUMN `abc`
`xyz` int(11) NOT NULL PRIMARY KEY*

I reckon this is because we add 'PRIMARY KEY' constraint to alter table
statement. How can I avoid this?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.