Skip to content

Instantly share code, notes, and snippets.

@laowantong
Created November 29, 2015 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laowantong/054035211aa9e7e14b57 to your computer and use it in GitHub Desktop.
Save laowantong/054035211aa9e7e14b57 to your computer and use it in GitHub Desktop.
{
"extension": "_oracle.sql",
"transform_attribute": [
{
"search": " ",
"replace": "_"
},
{
"search": "\\.",
"replace": ""
}
],
"compose_label_disambiguated_by_number": "{label}_{disambiguation_number}",
"transform_title": [
{
"search": " ",
"replace": "_"
},
{
"search": "\\.",
"replace": ""
}
],
"transform_relation_name": [
{
"search": " ",
"replace": "_"
},
{
"search": "\\.",
"replace": ""
}
],
"compose_primary_key": "\"{label_lowercase}\" {data_type},\nADD_PRIMARY \"{label_lowercase}\"",
"compose_normal_attribute": "\"{label_lowercase}\" {data_type}",
"compose_foreign_key": "\"{label_lowercase}\" {data_type},\n ALTER TABLE \"{this_relation_name_uppercase}\" ADD FOREIGN KEY (\"{label_lowercase}\") REFERENCES \"{primary_relation_name_uppercase}\" (\"{raw_label_lowercase}\");",
"compose_foreign_primary_key": "\"{label_lowercase}\" {data_type},\nADD_PRIMARY \"{label_lowercase}\",\n ALTER TABLE \"{this_relation_name_uppercase}\" ADD FOREIGN KEY (\"{label_lowercase}\") REFERENCES \"{primary_relation_name_uppercase}\" (\"{raw_label_lowercase}\");",
"column_separator": ",\n ",
"compose_relation": "CREATE TABLE \"{this_relation_name_uppercase}\" (\n {columns},\n PRIMARY KEY()\n);\n",
"transform_single_column_relation": [
{
"search": "(?s)(.+)\n",
"replace": "/*\n\\1\n*/\n"
}
],
"transform_relation": [
{
"search": "(?sm)ADD_PRIMARY ([^\n]+)\n(.+?PRIMARY KEY[^\n]+?)\\)",
"replace": "\\2\\1 )",
"iterated": true
},
{
"search": ", \\)",
"replace": ")"
}
],
"relation_separator": "\n",
"transform_relational_schema": [
{
"search": "(?s)(.+)",
"replace": "\\1\n"
},
{
"search": "(?sm)^ (ALTER TABLE [^\n]+),\n(.+)",
"replace": "\\2\\1\n",
"iterated": true
},
{
"search": "\n+$",
"replace": ""
},
{
"search": "(CREATE TABLE (\".+?\") \\(\n(?:.+\n)+? PRIMARY KEY\\((\".+?\"), (\".+?\")\\)\n(?:.*\n)+?ALTER TABLE (\".+?\") ADD FOREIGN KEY) \\((\".+?\")\\) REFERENCES \\2 \\(\\3\\);\nALTER TABLE \\5 ADD FOREIGN KEY \\((\".+?\")\\) REFERENCES \\2 \\(\\4\\);",
"replace": "\\1 (\\6, \\7) REFERENCES \\2 (\\3, \\4);",
"iterated": true
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment