CHARP fix sql.pl - pupitetris/charp GitHub Wiki

This script is called by initdb.sh when generating the 04-tables.sql file to overcome some of Power Architect's limitations. Its input file is SQL exported from Power Architect and it performs the following adaptations:

  • Support for data types unknown to Power Architect, such as ENUMs, ARRAYs and INET. To achieve this on a given column for a table, set the column's data type as 'OTHER' and on the 'Remarks' field enter TYPE ''my_custom_type'', and this will be the type for the column at the output of fix-sql.pl. If you need to add further comments to the column, just put them on a new line after the TYPE declaration.
  • Translates the input SQL to UTF-8 on Windows/Cygwin. This is particularly useful to correctly maintain accented characters and similar symbols on the comments.
  • Custom data type creation (use TYPE ''my_custom type'' AS ''<CREATE TYPE declaration>''). This feature is deprecated. It's better to explicitly state your custom data types in the 03-types.sql file.

Usage

fix-sql.pl works as a filter program:

$ ./fix-sql.pl < ''path_to_exported_sql'' > ../sql/04-tables.sql

⚠️ **GitHub.com Fallback** ⚠️