Permalink
Browse files

SQLite assume TEXT as datatype if not provided

  • Loading branch information...
trevorsibanda committed Apr 18, 2017
1 parent 46eec4a commit fba9a43a95772f06110b00dcb8f0a9a8d309163e
@@ -1,2 +1,3 @@
CREATE TABLE "SUPPLIERS" ("SUP_ID" INTEGER NOT NULL,"SUP_NAME" VARCHAR(254) NOT NULL,"STREET" VARCHAR(254) NOT NULL,"CITY" VARCHAR(254) NOT NULL,"STATE" VARCHAR(254) NOT NULL,"ZIP" VARCHAR(254) NOT NULL);
CREATE TABLE "COFFEES" ("COF_NAME" VARCHAR(254) NOT NULL,"SUP_ID" INTEGER NOT NULL,"PRICE" DOUBLE NOT NULL,"SALES" INTEGER NOT NULL,"TOTAL" INTEGER NOT NULL,constraint "SUP_FK" foreign key("SUP_ID") references "SUPPLIERS"("SUP_ID") on update NO ACTION on delete NO ACTION);
CREATE TABLE models (modelKey PRIMARY KEY, devKey, name, lang, version, code);
@@ -85,10 +85,13 @@ object GeneratedCodeTest {
import CG3._
import profile.api._
val s = Supplier(49, "Superior Coffee", "1 Party Place", "Mendocino", "CA", "95460")
val m = Model(Some("key"), Some("1000"), Some("model"), Some("en"), Some("0.0.1"), None)
DBIO.seq(
schema.create,
Suppliers += s,
Suppliers.result.map(assertEquals(List(s), _))
Models += m,
Suppliers.result.map(assertEquals(List(s), _)),
Models.result.map(assertEquals(List(m), _))
)
}
@@ -100,6 +100,7 @@ trait SQLiteProfile extends JdbcProfile {
final val TypePattern = "^([A-Z]+)(\\(([0-9]+)\\))?$".r
private val (_dbType,_size) = meta.typeName match {
case TypePattern(d,_,s) => (d, Option(s).map(_.toInt))
case "" => ("TEXT", None)
}
override def dbType = Some(_dbType)
override def length = _size

0 comments on commit fba9a43

Please sign in to comment.