diff options
author | Zach Smith <zach@driver.xyz> | 2018-02-02 11:25:31 -0800 |
---|---|---|
committer | Zach Smith <zach@driver.xyz> | 2018-02-02 11:25:31 -0800 |
commit | fac4c03b45abe9dd3e5b2713dad7f1649992f6e2 (patch) | |
tree | 5b7279d43ea1819671da21e44f1d6a94771d1bc1 | |
parent | f6d5aed87edf688b768f209eca894631d831b560 (diff) | |
download | slick-codegen-plugin-fac4c03b45abe9dd3e5b2713dad7f1649992f6e2.tar.gz slick-codegen-plugin-fac4c03b45abe9dd3e5b2713dad7f1649992f6e2.tar.bz2 slick-codegen-plugin-fac4c03b45abe9dd3e5b2713dad7f1649992f6e2.zip |
Apply fix to foreign and primary keys
-rw-r--r-- | src/main/scala/SchemaParser.scala | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/scala/SchemaParser.scala b/src/main/scala/SchemaParser.scala index 5ea61bf..e7ef031 100644 --- a/src/main/scala/SchemaParser.scala +++ b/src/main/scala/SchemaParser.scala @@ -19,12 +19,18 @@ object ModelTransformation { def citextNoLength(dbModel: m.Model): m.Model = dbModel.copy( - tables = dbModel.tables.map( - table => - table.copy( - columns = table.columns.map(citextColumnNoLength), - indices = table.indices.map(index => index.copy(columns = index.columns.map(citextColumnNoLength))) - ))) + tables = dbModel.tables.map(table => + table.copy( + primaryKey = table.primaryKey.map(pk => pk.copy(columns = pk.columns.map(citextColumnNoLength))), + columns = table.columns.map(citextColumnNoLength), + indices = table.indices.map(index => index.copy(columns = index.columns.map(citextColumnNoLength))), + foreignKeys = table.foreignKeys.map { fk => + fk.copy( + referencedColumns = fk.referencedColumns.map(citextColumnNoLength), + referencingColumns = fk.referencingColumns.map(citextColumnNoLength) + ) + } + ))) def references( dbModel: m.Model, |