DB schema dumper/tester
authorTomas Zeman <tzeman@volny.cz>
Fri, 10 Feb 2012 09:53:07 +0100
changeset 12 2fb331324cd9
parent 11 43fa65f5072e
child 13 29d4ddcd85c8
DB schema dumper/tester
src/main/scala/fis/top/model/FisDbSchema.scala
src/test/scala/fis/top/model/FisDbSchemaSpec.scala
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/fis/top/model/FisDbSchema.scala	Fri Feb 10 09:53:07 2012 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package fis.top.model
+
+import fis.base.model.BaseSchema
+import fis.crm.model.CrmSchema
+import fis.geo.model.GeoSchema
+
+trait FisDbSchema extends BaseSchema
+  with CrmSchema
+  with GeoSchema
+
+object FisDbSchema extends FisDbSchema
+
+// vim: set ts=2 sw=2 et:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/scala/fis/top/model/FisDbSchemaSpec.scala	Fri Feb 10 09:53:07 2012 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package fis.top.model
+
+import fis.base.model._
+import java.io._
+
+class FisDbSchemaSpec extends AbstractTest {
+
+  "FisDbSchema" should "create" in { doInDB {
+    schema.dropAndCreate
+  }}
+
+  it should "generate schema definition" in {
+    val f = new File("target/fis-db-schema.sql")
+    val pw = new PrintWriter(f)
+    schema.printDdl(pw)
+    pw.flush
+    pw.close
+  }
+
+  object schema extends FisDbSchema with DropAndCreate
+}
+
+// vim: set ts=2 sw=2 et: