[symfony-users] Re: Add Foreign Key to mysql table

2009-04-04 Thread DEEPAK BHATIA
Hi,

The problem is solved when I run below command

ALTER TABLE projecttype_table TYPE=InnoDB;

Thanks

Deepak Bhatia

On 4/2/09, whalexis alexis.degrugill...@gmail.com wrote:


 Hi you should have a look at this
 http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
 Everything you need is there

 On Apr 2, 4:10 am, DeepakBhatia toreachdee...@gmail.com wrote:
  I have two tables as given below. I need to add a column in
  project_table which is INT and refers to the projecttype_table(id)
  field.
 
  project_table
  {
  Name Varchar(100)
 
  }
 
  projecttype_table
  {
  id INT AUTO INCREMENT NOT NULL,
  projecttype_name Varchar(50)
 
  }
 
  Approach #1
  ===
 
  mysql alter table project_table add foreign key(project_type)
  references projecttype_table(id);
  ERROR 1005 (HY000): Can't create table 'rtdb2.#sql-358a_96c' (errno:
  150)
 
  Approach #2
  ===
  mysql ALTER TABLE project_table TYPE=InnoDB;
  Query OK, 7 rows affected, 1 warning (0.02 sec)
  Records: 7 Duplicates: 0 Warnings: 0
 
  mysql alter table project_table add Foreign key (project_type)
  REFERENCES projecttype_table(id);
  ERROR 1005 (HY000): Can't create table 'rtdb2.#sql-358a_96c' (errno:
  150)
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Add Foreign Key to mysql table

2009-04-02 Thread DeepakBhatia

I have two tables as given below. I need to add a column in
project_table which is INT and refers to the projecttype_table(id)
field.

project_table
{
Name Varchar(100)
}

projecttype_table
{
id INT AUTO INCREMENT NOT NULL,
projecttype_name Varchar(50)
}

Approach #1
===

mysql alter table project_table add foreign key(project_type)
references projecttype_table(id);
ERROR 1005 (HY000): Can't create table 'rtdb2.#sql-358a_96c' (errno:
150)

Approach #2
===
mysql ALTER TABLE project_table TYPE=InnoDB;
Query OK, 7 rows affected, 1 warning (0.02 sec)
Records: 7 Duplicates: 0 Warnings: 0

mysql alter table project_table add Foreign key (project_type)
REFERENCES projecttype_table(id);
ERROR 1005 (HY000): Can't create table 'rtdb2.#sql-358a_96c' (errno:
150)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Add Foreign Key to mysql table

2009-04-02 Thread whalexis

Hi you should have a look at this 
http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
Everything you need is there

On Apr 2, 4:10 am, DeepakBhatia toreachdee...@gmail.com wrote:
 I have two tables as given below. I need to add a column in
 project_table which is INT and refers to the projecttype_table(id)
 field.

 project_table
 {
 Name Varchar(100)

 }

 projecttype_table
 {
 id INT AUTO INCREMENT NOT NULL,
 projecttype_name Varchar(50)

 }

 Approach #1
 ===

 mysql alter table project_table add foreign key(project_type)
 references projecttype_table(id);
 ERROR 1005 (HY000): Can't create table 'rtdb2.#sql-358a_96c' (errno:
 150)

 Approach #2
 ===
 mysql ALTER TABLE project_table TYPE=InnoDB;
 Query OK, 7 rows affected, 1 warning (0.02 sec)
 Records: 7 Duplicates: 0 Warnings: 0

 mysql alter table project_table add Foreign key (project_type)
 REFERENCES projecttype_table(id);
 ERROR 1005 (HY000): Can't create table 'rtdb2.#sql-358a_96c' (errno:
 150)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---