Here’s a quick Python script for adding columns for all tables in your EER model. This will create a create_time and update_time columns in all tables, but you can modify it to your needs. To execute:
- go to Scripting -> Scripting Shell…
- click the New Script toolbar icon at the top left corner
- select Python Script and specify some name for the script file
- click Create
- copy/paste the script there
- click the Execute toolbar button
Make sure to backup your model before running this!
The code
# get a reference to the schema in the model. This will get the 1st schema in it. schema = grt.root.wb.doc.physicalModels[0].catalog.schemata[0] # iterate through all tables for table in schema.tables: # create a new column object and set its name column = grt.classes.db_mysql_Column() column.name = "create_time" # add it to the table table.addColumn(column) # set the datatype of the column column.setParseType("TIMESTAMP", None) column.defaultValue = "CURRENT_TIMESTAMP" # same thing for the update_time column column = grt.classes.db_mysql_Column() column.name = "update_time" table.addColumn(column) column.setParseType("TIMESTAMP", None)