diff options
author | Dico <dico.karssiens@gmail.com> | 2018-08-02 18:22:36 +0100 |
---|---|---|
committer | Dico <dico.karssiens@gmail.com> | 2018-08-02 18:22:36 +0100 |
commit | 0af2e615d3fa1d8509be46e14f99d40dc9cdb342 (patch) | |
tree | 3864043218969a67b5df17784a05c6af424e3617 /src/main/kotlin/io/dico/parcels2/storage/migration/plotme/PlotmeTables.kt | |
parent | 6513ad9237dbda0244a52608ae639fee5822b3ee (diff) |
Refactor and improve a lot of the API. Move default implementations into a package. Reformatting.
Diffstat (limited to 'src/main/kotlin/io/dico/parcels2/storage/migration/plotme/PlotmeTables.kt')
-rw-r--r-- | src/main/kotlin/io/dico/parcels2/storage/migration/plotme/PlotmeTables.kt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/kotlin/io/dico/parcels2/storage/migration/plotme/PlotmeTables.kt b/src/main/kotlin/io/dico/parcels2/storage/migration/plotme/PlotmeTables.kt new file mode 100644 index 0000000..3d07955 --- /dev/null +++ b/src/main/kotlin/io/dico/parcels2/storage/migration/plotme/PlotmeTables.kt @@ -0,0 +1,26 @@ +package io.dico.parcels2.storage.migration.plotme + +import org.jetbrains.exposed.sql.Table + +const val uppercase: Boolean = false +@Suppress("ConstantConditionIf") +fun String.toCorrectCase() = if (uppercase) this else toLowerCase() + +sealed class PlotmeTable(name: String) : Table(name) { + val px = PlotmePlotsT.integer("idX").primaryKey() + val pz = PlotmePlotsT.integer("idZ").primaryKey() + val world_name = PlotmePlotsT.varchar("world", 32).primaryKey() +} + +object PlotmePlotsT : PlotmeTable("plotmePlots".toCorrectCase()) { + val owner_name = varchar("owner", 32) + val owner_uuid = blob("ownerid").nullable() +} + +sealed class PlotmePlotPlayerMap(name: String) : PlotmeTable(name) { + val player_name = PlotmePlotsT.varchar("player", 32) + val player_uuid = PlotmePlotsT.blob("playerid").nullable() +} + +object PlotmeAllowedT : PlotmePlotPlayerMap("plotmeAllowed".toCorrectCase()) +object PlotmeDeniedT : PlotmePlotPlayerMap("plotmeDenied".toCorrectCase()) |