Skip to content
Snippets Groups Projects
Commit 4f095ede authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Fixed Sql Create Statments

parent 1084d53c
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ import com.j256.ormlite.jdbc.JdbcConnectionSource
import com.j256.ormlite.table.TableUtils
import de.tobias.playpad.server.account.{Account, Session}
import de.tobias.playpad.server.plugin.Plugin
import de.tobias.playpad.server.server.SqlHelper
import de.tobias.playpad.server.server.account._
import de.tobias.playpad.server.server.plugin.{PluginGet, PluginList}
import de.tobias.playpad.server.server.project._
......@@ -47,6 +48,7 @@ object PlayPadServer extends App {
TableUtils.createTableIfNotExists(connectionSource, classOf[Plugin])
TableUtils.createTableIfNotExists(connectionSource, classOf[Account])
TableUtils.createTableIfNotExists(connectionSource, classOf[Session])
SqlHelper.createTables(databaseConnection)
// Setup Http Server
port(8090)
......
......@@ -76,7 +76,7 @@ object SqlHelper {
}
createTable(
"""CREATE TABLE `Project` (
"""CREATE TABLE IF NOT EXISTS `Project` (
| `id` varchar(48) NOT NULL DEFAULT '',
| `name` varchar(255) DEFAULT NULL,
| `account_id` int(11) DEFAULT NULL,
......@@ -84,28 +84,28 @@ object SqlHelper {
| UNIQUE KEY `id` (`id`)
|) ENGINE=InnoDB DEFAULT CHARSET=latin1;""".stripMargin)
createTable(
"""CREATE TABLE `Page` (
"""CREATE TABLE IF NOT EXISTS `Page` (
| `id` varchar(48) NOT NULL DEFAULT '',
| `name` varchar(255) DEFAULT NULL,
| `position` int(11) DEFAULT NULL,
| `project_id` varchar(48) DEFAULT NULL,
| PRIMARY KEY (`id`),
| UNIQUE KEY `id` (`id`)
| UNIQUE KEY `id` (`id`),
| CONSTRAINT `Page_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `Project` (`id`) ON DELETE CASCADE
|) ENGINE=InnoDB DEFAULT CHARSET=latin1;""".stripMargin)
createTable(
"""CREATE TABLE `Pad` (
"""CREATE TABLE IF NOT EXISTS `Pad` (
| `id` varchar(48) NOT NULL DEFAULT '',
| `name` varchar(255) DEFAULT NULL,
| `position` int(11) DEFAULT NULL,
| `page` int(11) DEFAULT NULL,
| `page_id` varchar(48) DEFAULT NULL,
| PRIMARY KEY (`id`),
| UNIQUE KEY `id` (`id`)
| UNIQUE KEY `id` (`id`),
| CONSTRAINT `Pad_ibfk_1` FOREIGN KEY (`page_id`) REFERENCES `Page` (`id`) ON DELETE CASCADE
|) ENGINE=InnoDB DEFAULT CHARSET=latin1;""".stripMargin)
createTable(
"""CREATE TABLE `Path` (
"""CREATE TABLE IF NOT EXISTS `Path` (
| `id` varchar(40) NOT NULL DEFAULT '',
| `path` text,
| `pad_id` varchar(40) DEFAULT NULL,
......@@ -114,7 +114,7 @@ object SqlHelper {
| CONSTRAINT `Path_ibfk_1` FOREIGN KEY (`pad_id`) REFERENCES `Pad` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|) ENGINE=InnoDB DEFAULT CHARSET=latin1;""".stripMargin)
createTable(
"""CREATE TABLE `Design` (
"""CREATE TABLE IF NOT EXISTS `Design` (
| `id` varchar(40) NOT NULL DEFAULT '',
| `background_color` varchar(20) DEFAULT NULL,
| `play_color` varchar(20) DEFAULT NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment