Book a Demo

Author Topic: MySQL and Comments for Columns - ddl-generation  (Read 2568 times)

AxelM

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
MySQL and Comments for Columns - ddl-generation
« on: February 07, 2007, 01:20:48 pm »
Hello,

i want set comments for each column in a table. Ok, if i have default values than i can add the comment like this "comment 'x'" for the column in the initial field after the default value.

but i have not everytime a default value.

For example, i want this from the generator:

CREATE TABLE foo
(
   X int COMMENT 'description',
);

and not this one:

CREATE TABLE foo
(
   X int DEFAULT COMMENT 'description'  //
);

i try to set the comment with a tagged value for a column, but this will not working.

what can i do?

Thanks Axel ???

AxelM

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: MySQL and Comments for Columns - ddl-generatio
« Reply #1 on: February 28, 2007, 05:01:32 am »
Hello,
this problem is solved.
In the Dialog "Genereate DDL" ComboBox "Comment Level" the defaultvalue is Table. The choice now is Column an will work now fine without hacks.


Now, i have an other problem with generating FK.

Example:

Table 1: (Stereotype <<Table>>)






idint (Primarykey)
typeidint (Foreignkey)


Table 2: (Stereotype <<Table>>)





idint (Primarykey) is Foreignkey for Table 1


The Output sql for table 1 is wrong for mySql:
Code: [Select]

DROP TABLE IF EXISTS foo ;
CREATE TABLE foo
(

id INTEGER NOT NULL AUTO_INCREMENT COMMENT 'ID',

typeid INTEGER NOT NULL COMMENT 'Typeid',

PRIMARY KEY (id),

KEY (typeid) // this one will NOT work
)  ;


ALTER TABLE foo ADD CONSTRAINT FK_typeid

FOREIGN KEY (typeid) REFERENCES footpye (id) ;

O.k. I thing i must change the Transformationtemplate for DDL. It sems that i work on the false template, because i can change everything, delete for example completly the classtemplate  and  i will get the same output or it has no effect. It's happen also i restart EA.

My Question is now:

Where and what for a template must i change,so it produce this output:
Code: [Select]

CREATE TABLE foo
(

id INTEGER NOT NULL AUTO_INCREMENT COMMENT 'ID',

typeid INTEGER NOT NULL COMMENT 'Typeid',

PRIMARY KEY (id),

FOREIGN KEY (typeid) REFERENCES footpye (id) ; // so is it ok
)  ;


Thanks for any idea.