Book a Demo

Author Topic: DDL-Transformation - set "not null", length and scale in macro  (Read 6098 times)

sebastian_knox

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
DDL-Transformation - set "not null", length and scale in macro
« on: January 27, 2016, 09:59:16 pm »
Hello,

I am currently trying to add some columns to my DDL-Modell while transforming from a Class Model (depending on stereotypes). It works kind of, but I am not able to pass information like "Not null", the length or the scale to the DDL-Modell.
This is the intermediary debugging code I gained from an Data-Model > DDL Transformation where those values where set in the Data Model:

Column
{
  notes=""
  scope="Public"
  container=""
  alias=""
  lowerbound="1"
  name="kennung_ursprung"
  default=""
  upperbound="1"
  type="VARCHAR"
}

As you can see, there ain't no fields for the attributes mentioned above. Is there any chance I missed something here?

Cheers

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: DDL-Transformation - set "not null", length and scale in macro
« Reply #1 on: January 27, 2016, 10:37:09 pm »
Not null can be derived from the lowerbound.
If the lowerbound is 1 then it is not null.

The length and scale might be derived from the defined datatype in the database datatypes, or maybe from certain tagged values.

Geert

sebastian_knox

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: DDL-Transformation - set "not null", length and scale in macro
« Reply #2 on: January 28, 2016, 12:16:29 am »
Hi Geert,

thanks for your answer!
I had a similiar idea, but my problem still is, that i could not get the checkbox active for "not null" in my resulting DDL-model. I would need this for getting the proper SQL-Code for my Typo3-Database. Something like that:

Column
{
  notes=""
  scope="Public"
  container=""
  alias=""
  lowerbound="1"
  name="kennung_ursprung"
  default=""
  upperbound="1"
  type="VARCHAR"
  not_null = true
}

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: DDL-Transformation - set "not null", length and scale in macro
« Reply #3 on: January 28, 2016, 12:54:04 pm »
See the "Columns" section of the table at the end of the following page:
http://sparxsystems.com/enterprise_architect_user_guide/12.1/model_transformation/transformingobjects.html

Quote
Columns are similar to attributes, but have an autonumber element containing Startnum and its increment, and these added properties:
  • Length
  • NotNull
  • Precision
  • PrimaryKey
  • Scale
  • Unique
In the column definition, you cannot assign a value to the NotNull, PrimaryKey or Unique properties.

So just write "NotNull" without any value in the column definition.  You can also set the Length, Precision and Scale values as needed.

Example:

Column
{
  ...
  NotNull
}

sebastian_knox

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: DDL-Transformation - set "not null", length and scale in macro
« Reply #4 on: January 29, 2016, 10:34:01 pm »
Thanks Aaron! Now I am getting way closer to my desired results! My next task is to set Column-Options like AUTO_INCREMENT and UNSIGNED in my DDL-Transformation.

Cheers

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: DDL-Transformation - set "not null", length and scale in macro
« Reply #5 on: February 01, 2016, 11:14:20 am »
I think Auto Increment is something like:

Column
{
 Autonumber
 {
  Startnum="1"
  Increment="1"
 }
}

Not sure about other options like Unsigned.