Browse Source

DB init

master
sipp11 5 years ago
parent
commit
3e1be995ad
  1. 3
      app/build.gradle
  2. 20
      app/src/main/java/co/zzyzx/sensorlogger/Database.kt

3
app/build.gradle

@ -24,12 +24,13 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.kittinunf.fuel:fuel:2.1.0' implementation 'com.github.kittinunf.fuel:fuel:2.1.0'
implementation 'com.github.kittinunf.fuel:fuel-android:2.1.0' implementation 'com.github.kittinunf.fuel:fuel-android:2.1.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0-M2' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0-M2'
implementation 'org.jetbrains.exposed:exposed:0.16.1'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'

20
app/src/main/java/co/zzyzx/sensorlogger/Database.kt

@ -0,0 +1,20 @@
package co.zzyzx.sensorlogger
import org.jetbrains.exposed.dao.EntityID
import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
import org.jetbrains.exposed.dao.IntIdTable
object Records : IntIdTable() {
val timestamp = datetime("timestamp")
val sensor = varchar("sensor", 20)
val data = text("data:")
}
class Record(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<Record>(Records)
var timestamp by Records.timestamp
var sensor by Records.sensor
var data by Records.data
}
Loading…
Cancel
Save