GitLab wurde aktualisiert. Dank regelmäßiger Updates bleibt das THM GitLab sicher und Sie profitieren von den neuesten Funktionen. Vielen Dank für Ihre Geduld.

Commit 725c50fd authored by Tom Käsler's avatar Tom Käsler
Browse files

add global/sessoin motd base structure:

- case classes
- slick table definition
- db tables
parent a50f1a8e
Pipeline #7882 passed with stages
in 2 minutes and 43 seconds
......@@ -100,3 +100,24 @@ CREATE TABLE features (
PRIMARY KEY(id),
CONSTRAINT features_session_fk FOREIGN KEY (session_id) REFERENCES sessions(id) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=INNODB;
CREATE TABLE session_motds (
id INT NOT NULL AUTO_INCREMENT,
startdate VARCHAR(30) NOT NULL,
enddate VARCHAR(30) NOT NULL,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
audience VARCHAR(255) NOT NULL,
PRIMARY KEY(id)
) ENGINE=INNODB;
CREATE TABLE global_motds (
id INT NOT NULL AUTO_INCREMENT,
session_id INT NOT NULL,
startdate VARCHAR(30) NOT NULL,
enddate VARCHAR(30) NOT NULL,
title VARCHAR(255) NOT NULL,
content TEXT NOT NULL,
PRIMARY KEY(id),
CONSTRAINT global_motd_session_fk FOREIGN KEY (session_id) REFERENCES sessions(id) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=INNODB;
package de.thm.arsnova.models
case class SessionMotd(
id: Option[SessionMotdId],
sessionId: SessionId,
startdate: String,
enddate: String,
title: String,
text: String
)
case class GlobalMotd(
id: Option[GlobalMotdId],
startdate: String,
enddate: String,
title: String,
text: String,
audience: String
)
package de.thm.arsnova.models.definitions
import de.thm.arsnova.models.{GlobalMotd, GlobalMotdId}
import slick.driver.MySQLDriver.api._
import slick.lifted.ForeignKeyQuery
class GlobalMotdsTable(tag: Tag) extends Table[GlobalMotd](tag, "global_motds") {
def id: Rep[GlobalMotdId] = column[GlobalMotdId]("id", O.PrimaryKey, O.AutoInc)
def startdate: Rep[String] = column[String]("startdate")
def enddate: Rep[String] = column[String]("enddate")
def title: Rep[String] = column[String]("title")
def text: Rep[String] = column[String]("content")
def audience: Rep[String] = column[String]("audience")
def * = (id.?, startdate, enddate, title, text, audience) <> ((GlobalMotd.apply _).tupled, GlobalMotd.unapply)
}
package de.thm.arsnova.models.definitions
import de.thm.arsnova.models.{SessionMotd, SessionMotdId, SessionId}
import slick.driver.MySQLDriver.api._
import slick.lifted.ForeignKeyQuery
class SessionMotdsTable(tag: Tag) extends Table[SessionMotd](tag, "session_motds") {
def id: Rep[SessionMotdId] = column[SessionMotdId]("id", O.PrimaryKey, O.AutoInc)
def sessionId: Rep[SessionId] = column[SessionId]("session_id")
def startdate: Rep[String] = column[String]("startdate")
def enddate: Rep[String] = column[String]("enddate")
def title: Rep[String] = column[String]("title")
def text: Rep[String] = column[String]("content")
def * = (id.?, sessionId, startdate, enddate, title, text) <> ((SessionMotd.apply _).tupled, SessionMotd.unapply)
}
......@@ -8,4 +8,6 @@ package object models {
type ChoiceAnswerId = Long
type CommentId = Long
type FeaturesId = Long
type SessionMotdId = Long
type GlobalMotdId = Long
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment