(in string)
| 195 | } |
| 196 | |
| 197 | func convertForeignKeyActionCode(in string) string { |
| 198 | switch in { |
| 199 | case "a": |
| 200 | return "NO ACTION" |
| 201 | case "r": |
| 202 | return "RESTRICT" |
| 203 | case "c": |
| 204 | return "CASCADE" |
| 205 | case "n": |
| 206 | return "SET NULL" |
| 207 | case "d": |
| 208 | return "SET DEFAULT" |
| 209 | default: |
| 210 | return in |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | func getForeignKeyColumnsAndReferencedColumns(definition string) ([]string, []string, error) { |
| 215 | columnsRegexp := regexp.MustCompile(`FOREIGN KEY \((.*)\) REFERENCES (.*)\((.*)\)`) |