MySql workbench add created and modified columns for CAKEPHP


/ Published in: Python
Save to your folder(s)

Name this script whatever you want, and run it via Workbench Scripting shell


Copy this code and paste it in your HTML
  1. # -*- coding: utf-8 -*-
  2. # MySQL Workbench Python script
  3. # <description>
  4. # Written in MySQL Workbench 6.3.6
  5. import grt
  6. for table in schema.tables:
  7. column = grt.classes.db_mysql_Column()
  8. column.name = "created"
  9. table.addColumn(column)
  10. column.setParseType("TIMESTAMP", None)
  11. column.defaultValue = "CURRENT_TIMESTAMP"
  12. column = grt.classes.db_mysql_Column()
  13. column.name = "modified"
  14. table.addColumn(column)
  15. column.setParseType("TIMESTAMP", None)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.