From 63fea6a7aa9dccb010053e8e129465ac57c7a56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Sun, 24 Sep 2023 21:55:21 +0200 Subject: [PATCH] Add schoolShort field --- .../kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt | 2 ++ src/main/kotlin/io/github/wulkanowy/schools/model/LoginEvent.kt | 2 ++ src/main/resources/db/migration/V3__Add_schoolShort.sql | 1 + 3 files changed, 5 insertions(+) create mode 100644 src/main/resources/db/migration/V3__Add_schoolShort.sql diff --git a/src/main/kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt b/src/main/kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt index fb725b0..8b181f1 100644 --- a/src/main/kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt +++ b/src/main/kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt @@ -15,6 +15,7 @@ class LoginEventDao { private fun resultRowToLoginEvent(row: ResultRow) = LoginEvent( schoolName = row[LoginEvents.schoolName], + schoolShort = row[LoginEvents.schoolShort], schoolAddress = row[LoginEvents.schoolAddress], scraperBaseUrl = row[LoginEvents.scraperBaseUrl], symbol = row[LoginEvents.symbol], @@ -32,6 +33,7 @@ class LoginEventDao { LoginEvents.insert { it[uuid] = event.uuid it[schoolName] = event.schoolName + it[schoolShort] = event.schoolShort it[schoolAddress] = event.schoolAddress it[scraperBaseUrl] = event.scraperBaseUrl it[symbol] = event.symbol diff --git a/src/main/kotlin/io/github/wulkanowy/schools/model/LoginEvent.kt b/src/main/kotlin/io/github/wulkanowy/schools/model/LoginEvent.kt index aee2997..453f161 100644 --- a/src/main/kotlin/io/github/wulkanowy/schools/model/LoginEvent.kt +++ b/src/main/kotlin/io/github/wulkanowy/schools/model/LoginEvent.kt @@ -9,6 +9,7 @@ import java.util.* data class LoginEvent( val uuid: String, val schoolName: String, + val schoolShort: String, val schoolAddress: String, val scraperBaseUrl: String, val symbol: String, @@ -21,6 +22,7 @@ object LoginEvents : Table() { val uuid = varchar("uuid", 36) val timestamp = timestamp("timestamp") val schoolName = varchar("schoolName", 256) + val schoolShort = varchar("schoolShortName", 256) val schoolAddress = varchar("schoolAddress", 256) val scraperBaseUrl = varchar("scraperBaseUrl", 128) val symbol = varchar("symbol", 64) diff --git a/src/main/resources/db/migration/V3__Add_schoolShort.sql b/src/main/resources/db/migration/V3__Add_schoolShort.sql new file mode 100644 index 0000000..84ab8df --- /dev/null +++ b/src/main/resources/db/migration/V3__Add_schoolShort.sql @@ -0,0 +1 @@ +ALTER TABLE loginevents ADD "schoolShortName" VARCHAR(256) NOT NULL DEFAULT '';