diff options
author | Linnea Gräf <nea@nea.moe> | 2025-01-22 01:34:16 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-01-22 01:34:16 +0100 |
commit | 0b760977102a05edd8f23cbaa9d6dcf042fede43 (patch) | |
tree | d60ce4f2a9a16409570a0d12ad919046ff5cc98c /database/impl/src/main | |
parent | 6f148df84dfe5d0d0d1c6a0614f86e374fc8d1aa (diff) | |
download | LocalTransactionLedger-0b760977102a05edd8f23cbaa9d6dcf042fede43.tar.gz LocalTransactionLedger-0b760977102a05edd8f23cbaa9d6dcf042fede43.tar.bz2 LocalTransactionLedger-0b760977102a05edd8f23cbaa9d6dcf042fede43.zip |
refactor: More type safe where clauses
Diffstat (limited to 'database/impl/src/main')
-rw-r--r-- | database/impl/src/main/kotlin/moe/nea/ledger/database/DBUpgrade.kt | 4 | ||||
-rw-r--r-- | database/impl/src/main/kotlin/moe/nea/ledger/database/Upgrades.kt | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/database/impl/src/main/kotlin/moe/nea/ledger/database/DBUpgrade.kt b/database/impl/src/main/kotlin/moe/nea/ledger/database/DBUpgrade.kt index 7d1782a..9739978 100644 --- a/database/impl/src/main/kotlin/moe/nea/ledger/database/DBUpgrade.kt +++ b/database/impl/src/main/kotlin/moe/nea/ledger/database/DBUpgrade.kt @@ -37,14 +37,14 @@ interface DBUpgrade { return upgrades.groupBy { it.toVersion } } - fun createTable(to: Long, table: Table, vararg columns: Column<*>): DBUpgrade { + fun createTable(to: Long, table: Table, vararg columns: Column<*, *>): DBUpgrade { require(columns.all { it in table.columns }) return of("Create table ${table}", to) { table.createIfNotExists(it, columns.toList()) } } - fun addColumns(to: Long, table: Table, vararg columns: Column<*>): DBUpgrade { + fun addColumns(to: Long, table: Table, vararg columns: Column<*, *>): DBUpgrade { return of("Add columns to table $table", to) { table.alterTableAddColumns(it, columns.toList()) } diff --git a/database/impl/src/main/kotlin/moe/nea/ledger/database/Upgrades.kt b/database/impl/src/main/kotlin/moe/nea/ledger/database/Upgrades.kt index e83abe7..76dfb5d 100644 --- a/database/impl/src/main/kotlin/moe/nea/ledger/database/Upgrades.kt +++ b/database/impl/src/main/kotlin/moe/nea/ledger/database/Upgrades.kt @@ -15,6 +15,4 @@ class Upgrades { DBItemEntry.itemId, DBItemEntry.size, DBItemEntry.mode, DBItemEntry.transactionId )) } - - }
\ No newline at end of file |