Repository: julioz/FloorPlan
Pull request #26 (2020-05-20 15:53:37)

Pull out Room and DBML models into modules
- The `:floorplan-cli` module now depends directly on `:room-consumer`, but the goal is that eventually that becomes ['consumer-agnostic'](https://github.com/julioz/FloorPlan/issues/19).

- There is a new `:dbml` module that is home for the DBML representations in Kotlin. This means parsing from DBML (in case of `:dbml-parser`) or as output (in case of `:room-consumer`) will share the same modeling representation, allowing for proper mapping.


Patch:
diff --git a/core/build.gradle b/core/build.gradle
index aca9717..5965844 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -12,6 +12,7 @@ repositories {
 }
 
 dependencies {
+    implementation project(":room-consumer") // TODO to be removed https://github.com/julioz/FloorPlan/issues/25
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
     implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0" // JVM dependency
     testImplementation "junit:junit:4.12"
diff --git a/core/src/main/kotlin/com/zynger/floorplan/dbml/Field.kt b/core/src/main/kotlin/com/zynger/floorplan/dbml/Field.kt
index 98678f9..0888051 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/dbml/Field.kt
+++ b/core/src/main/kotlin/com/zynger/floorplan/dbml/Field.kt
@@ -1,8 +1,8 @@
 package com.zynger.floorplan.dbml
 
 import com.zynger.floorplan.Settings
-import com.zynger.floorplan.model.PrimaryKey
-import com.zynger.floorplan.model.Field as DbField
+import com.zynger.floorplan.room.PrimaryKey
+import com.zynger.floorplan.room.Field as DbField
 
 class Field(
     private val field: DbField,
diff --git a/core/src/main/kotlin/com/zynger/floorplan/dbml/Index.kt b/core/src/main/kotlin/com/zynger/floorplan/dbml/Index.kt
index d7a0d8e..689ed81 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/dbml/Index.kt
+++ b/core/src/main/kotlin/com/zynger/floorplan/dbml/Index.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.dbml
 
 import java.lang.StringBuilder
-import com.zynger.floorplan.model.Index as DbIndex
+import com.zynger.floorplan.room.Index as DbIndex
 
 class Index(
     private val index: DbIndex
diff --git a/core/src/main/kotlin/com/zynger/floorplan/dbml/Reference.kt b/core/src/main/kotlin/com/zynger/floorplan/dbml/Reference.kt
index f8b12f2..f81f8ff 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/dbml/Reference.kt
+++ b/core/src/main/kotlin/com/zynger/floorplan/dbml/Reference.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.dbml
 
-import com.zynger.floorplan.model.ForeignKey
-import com.zynger.floorplan.model.ForeignKeyAction
+import com.zynger.floorplan.room.ForeignKey
+import com.zynger.floorplan.room.ForeignKeyAction
 import java.lang.StringBuilder
 
 class Reference(
diff --git a/core/src/main/kotlin/com/zynger/floorplan/dbml/Table.kt b/core/src/main/kotlin/com/zynger/floorplan/dbml/Table.kt
index 061f7f7..00a60c8 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/dbml/Table.kt
+++ b/core/src/main/kotlin/com/zynger/floorplan/dbml/Table.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.dbml
 
 import com.zynger.floorplan.Settings
-import com.zynger.floorplan.model.Entity
+import com.zynger.floorplan.room.Entity
 
 class Table(
     entity: Entity,
diff --git a/dbml-parser/build.gradle b/dbml-parser/build.gradle
index ce06f61..5382966 100644
--- a/dbml-parser/build.gradle
+++ b/dbml-parser/build.gradle
@@ -11,6 +11,7 @@ repositories {
 }
 
 dependencies {
+    implementation project(":dbml")
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
     testImplementation "junit:junit:4.12"
 }
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Parser.kt b/dbml-parser/src/main/kotlin/com/zynger/floorplan/Parser.kt
index cd873b8..9ece1d7 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Parser.kt
+++ b/dbml-parser/src/main/kotlin/com/zynger/floorplan/Parser.kt
@@ -1,5 +1,6 @@
 package com.zynger.floorplan
 
+import com.zynger.floorplan.dbml.Project
 import com.zynger.floorplan.lex.LoneReferenceParser
 import com.zynger.floorplan.lex.TableParser
 
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Project.kt b/dbml-parser/src/main/kotlin/com/zynger/floorplan/Project.kt
deleted file mode 100644
index 928fef0..0000000
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Project.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.zynger.floorplan
-
-data class Project(
-    val tables: List<Table>,
-    val reference: List<Reference>
-)
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/ColumnParser.kt b/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/ColumnParser.kt
index 3edec00..90667d4 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/ColumnParser.kt
+++ b/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/ColumnParser.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.lex
 
-import com.zynger.floorplan.Column
-import com.zynger.floorplan.Reference
+import com.zynger.floorplan.dbml.Column
+import com.zynger.floorplan.dbml.Reference
 import org.intellij.lang.annotations.Language
 
 object ColumnParser {
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/ColumnReferenceParser.kt b/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/ColumnReferenceParser.kt
index 7b3ae5e..5679d21 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/ColumnReferenceParser.kt
+++ b/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/ColumnReferenceParser.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.lex
 
-import com.zynger.floorplan.Reference
-import com.zynger.floorplan.ReferenceOrder
+import com.zynger.floorplan.dbml.Reference
+import com.zynger.floorplan.dbml.ReferenceOrder
 import org.intellij.lang.annotations.Language
 
 object ColumnReferenceParser {
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/LoneReferenceParser.kt b/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/LoneReferenceParser.kt
index 93a0569..7d54397 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/LoneReferenceParser.kt
+++ b/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/LoneReferenceParser.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.lex
 
-import com.zynger.floorplan.Reference
-import com.zynger.floorplan.ReferenceOrder
+import com.zynger.floorplan.dbml.Reference
+import com.zynger.floorplan.dbml.ReferenceOrder
 import org.intellij.lang.annotations.Language
 
 object LoneReferenceParser {
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/TableParser.kt b/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/TableParser.kt
index c92ab29..4ea1aff 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/TableParser.kt
+++ b/dbml-parser/src/main/kotlin/com/zynger/floorplan/lex/TableParser.kt
@@ -1,6 +1,6 @@
 package com.zynger.floorplan.lex
 
-import com.zynger.floorplan.Table
+import com.zynger.floorplan.dbml.Table
 import org.intellij.lang.annotations.Language
 
 object TableParser {
@@ -32,4 +32,4 @@ object TableParser {
             )
         }.toList()
     }
-}
\ No newline at end of file
+}
diff --git a/dbml/build.gradle b/dbml/build.gradle
new file mode 100644
index 0000000..ce06f61
--- /dev/null
+++ b/dbml/build.gradle
@@ -0,0 +1,23 @@
+plugins {
+    id 'java'
+    id 'org.jetbrains.kotlin.jvm'
+}
+
+sourceCompatibility = 1.8
+
+repositories {
+    mavenCentral()
+    jcenter()
+}
+
+dependencies {
+    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
+    testImplementation "junit:junit:4.12"
+}
+
+compileKotlin {
+    kotlinOptions.jvmTarget = "1.8"
+}
+compileTestKotlin {
+    kotlinOptions.jvmTarget = "1.8"
+}
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Column.kt b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Column.kt
similarity index 92%
rename from dbml-parser/src/main/kotlin/com/zynger/floorplan/Column.kt
rename to dbml/src/main/kotlin/com/zynger/floorplan/dbml/Column.kt
index 6b0a046..4bdcd6d 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Column.kt
+++ b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Column.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan
+package com.zynger.floorplan.dbml
 
 data class Column(
     val rawValue: String,
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Index.kt b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Index.kt
similarity index 88%
rename from dbml-parser/src/main/kotlin/com/zynger/floorplan/Index.kt
rename to dbml/src/main/kotlin/com/zynger/floorplan/dbml/Index.kt
index c0ca2a1..2d2f2e6 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Index.kt
+++ b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Index.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan
+package com.zynger.floorplan.dbml
 
 data class Index(val name: String, val columnNames: List<String>? = null, val unique: Boolean = false){
     // TODO should we enforce that indexes must have column names? as to make the property not nullable
diff --git a/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Project.kt b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Project.kt
new file mode 100644
index 0000000..a0f689a
--- /dev/null
+++ b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Project.kt
@@ -0,0 +1,6 @@
+package com.zynger.floorplan.dbml
+
+data class Project(
+    val tables: List<Table>,
+    val references: List<Reference>
+)
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Reference.kt b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Reference.kt
similarity index 95%
rename from dbml-parser/src/main/kotlin/com/zynger/floorplan/Reference.kt
rename to dbml/src/main/kotlin/com/zynger/floorplan/dbml/Reference.kt
index 65fbdb4..c9b7105 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Reference.kt
+++ b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Reference.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan
+package com.zynger.floorplan.dbml
 
 import java.lang.IllegalArgumentException
 
diff --git a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Table.kt b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Table.kt
similarity index 80%
rename from dbml-parser/src/main/kotlin/com/zynger/floorplan/Table.kt
rename to dbml/src/main/kotlin/com/zynger/floorplan/dbml/Table.kt
index 92f440c..2e90533 100644
--- a/dbml-parser/src/main/kotlin/com/zynger/floorplan/Table.kt
+++ b/dbml/src/main/kotlin/com/zynger/floorplan/dbml/Table.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan
+package com.zynger.floorplan.dbml
 
 data class Table(
     val rawValue: String,
diff --git a/floorplan-cli/build.gradle b/floorplan-cli/build.gradle
index 301a281..4b7422c 100644
--- a/floorplan-cli/build.gradle
+++ b/floorplan-cli/build.gradle
@@ -20,8 +20,8 @@ application {
 
 dependencies {
     implementation project(":core")
+    implementation project(":room-consumer")
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
-    implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0" // JVM dependency
     testImplementation "junit:junit:4.12"
 }
 
diff --git a/floorplan-cli/src/main/kotlin/com/zynger/floorplan/App.kt b/floorplan-cli/src/main/kotlin/com/zynger/floorplan/App.kt
index 214ccc6..82f5ebf 100644
--- a/floorplan-cli/src/main/kotlin/com/zynger/floorplan/App.kt
+++ b/floorplan-cli/src/main/kotlin/com/zynger/floorplan/App.kt
@@ -1,20 +1,17 @@
 package com.zynger.floorplan
 
 import com.zynger.floorplan.dbml.Table
-import com.zynger.floorplan.model.Schema
-import kotlinx.serialization.json.Json
-import kotlinx.serialization.json.JsonConfiguration
+import com.zynger.floorplan.room.Database
+import com.zynger.floorplan.room.RoomConsumer
 import java.io.File
 
 fun main(args: Array<String>) {
     val input = InputParser.parse(args)
     val src = File(input.schemaPath)
-    val json = Json(JsonConfiguration.Stable.copy(ignoreUnknownKeys = true, isLenient = true))
+    val database: Database = RoomConsumer.read(src)
 
     val settings = Settings(input.creationSqlAsTableNote, input.renderNullableFields)
-    val dbml = json
-        .parse(Schema.serializer(), src.readText())
-        .database
+    val dbml = database
         .entities
         .map { Table(it, settings) }
         .joinToString(separator = "\n\n")
diff --git a/room-consumer/build.gradle b/room-consumer/build.gradle
new file mode 100644
index 0000000..149c8f2
--- /dev/null
+++ b/room-consumer/build.gradle
@@ -0,0 +1,26 @@
+plugins {
+    id 'java'
+    id 'org.jetbrains.kotlin.jvm'
+    id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.71'
+}
+
+sourceCompatibility = 1.8
+
+repositories {
+    mavenCentral()
+    jcenter()
+}
+
+dependencies {
+    implementation project(":dbml")
+    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
+    implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0" // JVM dependency
+    testImplementation "junit:junit:4.12"
+}
+
+compileKotlin {
+    kotlinOptions.jvmTarget = "1.8"
+}
+compileTestKotlin {
+    kotlinOptions.jvmTarget = "1.8"
+}
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/Database.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Database.kt
similarity index 86%
rename from core/src/main/kotlin/com/zynger/floorplan/model/Database.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/Database.kt
index 42983e2..be324d1 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/Database.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Database.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan.model
+package com.zynger.floorplan.room
 
 import kotlinx.serialization.Serializable
 
@@ -9,4 +9,4 @@ data class Database(
     val entities: List<Entity>,
     val views: List<View> = emptyList(),
     val setupQueries: List<String>
-)
\ No newline at end of file
+)
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/Entity.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Entity.kt
similarity index 87%
rename from core/src/main/kotlin/com/zynger/floorplan/model/Entity.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/Entity.kt
index 7f5eaae..57d53fc 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/Entity.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Entity.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan.model
+package com.zynger.floorplan.room
 
 import kotlinx.serialization.Serializable
 
@@ -10,4 +10,4 @@ data class Entity (
     val primaryKey: PrimaryKey,
     val indices: List<Index>,
     val foreignKeys: List<ForeignKey>
-)
\ No newline at end of file
+)
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/Field.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Field.kt
similarity index 85%
rename from core/src/main/kotlin/com/zynger/floorplan/model/Field.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/Field.kt
index a0de321..9e3b589 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/Field.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Field.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan.model
+package com.zynger.floorplan.room
 
 import kotlinx.serialization.Serializable
 
@@ -9,4 +9,4 @@ data class Field (
     val affinity: String,
     val notNull: Boolean,
     val defaultValue: String? = null
-)
\ No newline at end of file
+)
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/ForeignKey.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/ForeignKey.kt
similarity index 83%
rename from core/src/main/kotlin/com/zynger/floorplan/model/ForeignKey.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/ForeignKey.kt
index 3cae7c0..c72d789 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/ForeignKey.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/ForeignKey.kt
@@ -1,6 +1,6 @@
-package com.zynger.floorplan.model
+package com.zynger.floorplan.room
 
-import com.zynger.floorplan.model.serializer.ForeignKeyActionSerializer
+import com.zynger.floorplan.room.serializer.ForeignKeyActionSerializer
 import kotlinx.serialization.Serializable
 
 @Serializable
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/Index.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Index.kt
similarity index 83%
rename from core/src/main/kotlin/com/zynger/floorplan/model/Index.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/Index.kt
index 32dff96..49f66e1 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/Index.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Index.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan.model
+package com.zynger.floorplan.room
 
 import kotlinx.serialization.Serializable
 
@@ -8,4 +8,4 @@ data class Index (
     val unique: Boolean,
     val columnNames: List<String>,
     val createSql: String
-)
\ No newline at end of file
+)
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/PrimaryKey.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/PrimaryKey.kt
similarity index 80%
rename from core/src/main/kotlin/com/zynger/floorplan/model/PrimaryKey.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/PrimaryKey.kt
index 2b8126b..db9f1bb 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/PrimaryKey.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/PrimaryKey.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan.model
+package com.zynger.floorplan.room
 
 import kotlinx.serialization.Serializable
 
@@ -6,4 +6,4 @@ import kotlinx.serialization.Serializable
 data class PrimaryKey (
     val columnNames: List<String>,
     val autoGenerate: Boolean
-)
\ No newline at end of file
+)
diff --git a/room-consumer/src/main/kotlin/com/zynger/floorplan/room/RoomConsumer.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/RoomConsumer.kt
new file mode 100644
index 0000000..a5326d7
--- /dev/null
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/RoomConsumer.kt
@@ -0,0 +1,16 @@
+package com.zynger.floorplan.room
+
+import kotlinx.serialization.json.Json
+import kotlinx.serialization.json.JsonConfiguration
+import java.io.File
+
+object RoomConsumer {
+    private val json = Json(JsonConfiguration.Stable.copy(ignoreUnknownKeys = true, isLenient = true))
+
+    // TODO return DBML's plain `Project` model
+    fun read(src: File): Database {
+        return json
+            .parse(Schema.serializer(), src.readText())
+            .database
+    }
+}
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/Schema.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Schema.kt
similarity index 79%
rename from core/src/main/kotlin/com/zynger/floorplan/model/Schema.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/Schema.kt
index 80783ec..b007eb9 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/Schema.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/Schema.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan.model
+package com.zynger.floorplan.room
 
 import kotlinx.serialization.Serializable
 
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/View.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/View.kt
similarity index 78%
rename from core/src/main/kotlin/com/zynger/floorplan/model/View.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/View.kt
index e550422..f0f3ddf 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/View.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/View.kt
@@ -1,4 +1,4 @@
-package com.zynger.floorplan.model
+package com.zynger.floorplan.room
 
 import kotlinx.serialization.Serializable
 
diff --git a/core/src/main/kotlin/com/zynger/floorplan/model/serializer/ForeignKeyActionSerializer.kt b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/serializer/ForeignKeyActionSerializer.kt
similarity index 85%
rename from core/src/main/kotlin/com/zynger/floorplan/model/serializer/ForeignKeyActionSerializer.kt
rename to room-consumer/src/main/kotlin/com/zynger/floorplan/room/serializer/ForeignKeyActionSerializer.kt
index c38a14a..174e62d 100644
--- a/core/src/main/kotlin/com/zynger/floorplan/model/serializer/ForeignKeyActionSerializer.kt
+++ b/room-consumer/src/main/kotlin/com/zynger/floorplan/room/serializer/ForeignKeyActionSerializer.kt
@@ -1,6 +1,6 @@
-package com.zynger.floorplan.model.serializer
+package com.zynger.floorplan.room.serializer
 
-import com.zynger.floorplan.model.ForeignKeyAction
+import com.zynger.floorplan.room.ForeignKeyAction
 import kotlinx.serialization.*
 
 @Serializer(forClass = ForeignKeyAction::class)
diff --git a/settings.gradle b/settings.gradle
index 47bcca6..6f7dbc2 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,6 @@
 rootProject.name = 'floorplan'
 include 'core'
+include 'dbml'
 include 'dbml-parser'
 include 'floorplan-cli'
+include 'room-consumer'


Test patch:
diff --git a/core/src/test/kotlin/com/zynger/floorplan/dbml/FieldTest.kt b/core/src/test/kotlin/com/zynger/floorplan/dbml/FieldTest.kt
index fb3b4ca..ca7c931 100644
--- a/core/src/test/kotlin/com/zynger/floorplan/dbml/FieldTest.kt
+++ b/core/src/test/kotlin/com/zynger/floorplan/dbml/FieldTest.kt
@@ -1,9 +1,9 @@
 package com.zynger.floorplan.dbml
 
 import com.zynger.floorplan.Settings
-import com.zynger.floorplan.model.PrimaryKey
+import com.zynger.floorplan.room.PrimaryKey
 import org.junit.Assert.assertEquals
-import com.zynger.floorplan.model.Field as DbField
+import com.zynger.floorplan.room.Field as DbField
 import org.junit.Test
 
 class FieldTest {
diff --git a/core/src/test/kotlin/com/zynger/floorplan/dbml/IndexTest.kt b/core/src/test/kotlin/com/zynger/floorplan/dbml/IndexTest.kt
index d9f57fe..12f33b1 100644
--- a/core/src/test/kotlin/com/zynger/floorplan/dbml/IndexTest.kt
+++ b/core/src/test/kotlin/com/zynger/floorplan/dbml/IndexTest.kt
@@ -1,6 +1,6 @@
 package com.zynger.floorplan.dbml
 
-import com.zynger.floorplan.model.Index as DbIndex
+import com.zynger.floorplan.room.Index as DbIndex
 import org.junit.Assert
 import org.junit.Test
 
diff --git a/core/src/test/kotlin/com/zynger/floorplan/dbml/ReferenceTest.kt b/core/src/test/kotlin/com/zynger/floorplan/dbml/ReferenceTest.kt
index bfdc7cc..c127da1 100644
--- a/core/src/test/kotlin/com/zynger/floorplan/dbml/ReferenceTest.kt
+++ b/core/src/test/kotlin/com/zynger/floorplan/dbml/ReferenceTest.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.dbml
 
-import com.zynger.floorplan.model.ForeignKey
-import com.zynger.floorplan.model.ForeignKeyAction
+import com.zynger.floorplan.room.ForeignKey
+import com.zynger.floorplan.room.ForeignKeyAction
 import org.junit.Assert
 import org.junit.Test
 
diff --git a/core/src/test/kotlin/com/zynger/floorplan/dbml/TableTest.kt b/core/src/test/kotlin/com/zynger/floorplan/dbml/TableTest.kt
index b39e03c..db6b61b 100644
--- a/core/src/test/kotlin/com/zynger/floorplan/dbml/TableTest.kt
+++ b/core/src/test/kotlin/com/zynger/floorplan/dbml/TableTest.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.dbml
 
 import com.zynger.floorplan.Settings
-import com.zynger.floorplan.model.*
+import com.zynger.floorplan.room.*
 import org.junit.Assert.assertEquals
 import org.junit.Test
 
diff --git a/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/ColumnParserTest.kt b/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/ColumnParserTest.kt
index 8cd040d..ac032ea 100644
--- a/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/ColumnParserTest.kt
+++ b/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/ColumnParserTest.kt
@@ -1,6 +1,6 @@
 package com.zynger.floorplan.lex
 
-import com.zynger.floorplan.Column
+import com.zynger.floorplan.dbml.Column
 import org.junit.Assert.*
 import org.junit.Test
 
diff --git a/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/ColumnReferenceParserTest.kt b/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/ColumnReferenceParserTest.kt
index 6aba668..44a065f 100644
--- a/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/ColumnReferenceParserTest.kt
+++ b/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/ColumnReferenceParserTest.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.lex
 
-import com.zynger.floorplan.Reference
-import com.zynger.floorplan.ReferenceOrder
+import com.zynger.floorplan.dbml.Reference
+import com.zynger.floorplan.dbml.ReferenceOrder
 import org.junit.Assert.assertEquals
 import org.junit.Test
 
diff --git a/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/LoneReferenceParserTest.kt b/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/LoneReferenceParserTest.kt
index b84906c..5a2405b 100644
--- a/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/LoneReferenceParserTest.kt
+++ b/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/LoneReferenceParserTest.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.lex
 
-import com.zynger.floorplan.Reference
-import com.zynger.floorplan.ReferenceOrder
+import com.zynger.floorplan.dbml.Reference
+import com.zynger.floorplan.dbml.ReferenceOrder
 import org.junit.Assert.assertEquals
 import org.junit.Test
 
diff --git a/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/TableParserTest.kt b/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/TableParserTest.kt
index ed3c144..d3ed5ea 100644
--- a/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/TableParserTest.kt
+++ b/dbml-parser/src/test/kotlin/com/zynger/floorplan/lex/TableParserTest.kt
@@ -1,7 +1,7 @@
 package com.zynger.floorplan.lex
 
-import com.zynger.floorplan.Index
-import com.zynger.floorplan.Table
+import com.zynger.floorplan.dbml.Index
+import com.zynger.floorplan.dbml.Table
 import org.junit.Assert.*
 import org.junit.Test
 
@@ -94,4 +94,4 @@ class TableParserTest {
 
         assertEquals(emptyList<Index>(), tables[0].indexes)
     }
-}
\ No newline at end of file
+}