diff options
author | Marvin Borner | 2019-04-04 15:26:08 +0200 |
---|---|---|
committer | Marvin Borner | 2019-04-04 15:26:08 +0200 |
commit | b71c055a8a198a1071b5905904096630aba98361 (patch) | |
tree | 47a53b620bbba632d1c4c98b328cc786e16f0e27 /src/main/kotlin/DB.kt | |
parent | b0a2b6c5a19e0e20d50d29f52d640b5f7d19f841 (diff) |
Cleaned up code
Diffstat (limited to 'src/main/kotlin/DB.kt')
-rw-r--r-- | src/main/kotlin/DB.kt | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/main/kotlin/DB.kt b/src/main/kotlin/DB.kt deleted file mode 100644 index a01a1e6..0000000 --- a/src/main/kotlin/DB.kt +++ /dev/null @@ -1,48 +0,0 @@ -package space.anity - -import org.jetbrains.exposed.sql.* -import org.jetbrains.exposed.sql.transactions.* -import java.sql.* - - -class DB(val dbFileLocation: String = "main.db") { - val db :Database - - /** - * Database table for the file location indexing - */ - object FileLocation : Table() { - val id = integer("id").autoIncrement().primaryKey() - val location = text("location") - } - - /** - * Database table to index the users with their regarding passwords - */ - object UserData : Table() { - // only for multiple users: - // val id = integer("id").autoIncrement().primaryKey() - val username = varchar("username", 24).primaryKey() // remove .primaryKey(), if id column is used - val password = varchar("password", 64) - } - - /** - * Database table storing general data/states - */ - object General : Table() { - val initialUse = integer("initialUse").default(0).primaryKey() // boolean -> 0:1 - } - - init { - // create connection - this.db = Database.connect("jdbc:sqlite:main.db", "org.sqlite.JDBC") - TransactionManager.manager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE - - // add tables - transaction { - SchemaUtils.createMissingTablesAndColumns(FileLocation, UserData, General) - } - } - - // TODO add functions for database usage -}
\ No newline at end of file |