MXS-1216: Add real_type and length to cdc_schema.py

The schema generator program needs to add the real_type and length fields
if the data types define them.

Also fixed a bug where the real_type and length fields were checked for
generated fields.
This commit is contained in:
Markus Mäkelä
2017-05-16 13:27:46 +03:00
parent 5a0d2c54bd
commit ad109408b5
2 changed files with 38 additions and 24 deletions

View File

@ -33,7 +33,15 @@ opts = parser.parse_args(sys.argv[1:])
def parse_field(row):
res = dict()
name = row[1].lower().split('(')[0]
parts = row[1].lower().split('(')
name = parts[0]
res["real_type"] = name
if len(parts) > 1:
res["length"] = int(parts[1].split(')')[0])
else:
res["length"] = -1
if name in ("date", "datetime", "time", "timestamp", "year", "tinytext", "text",
"mediumtext", "longtext", "char", "varchar", "enum", "set"):