stmt.close()
if (!tableExists) {
- println("Database empty — creating tables...")
+ println("Database empty: creating tables")
conn.createStatement().use { createStmt ->
+ createStmt.addBatch("""
+ CREATE TABLE groups (
+ group_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
+ name VARCHAR
+ )
+ """.trimIndent())
+
createStmt.addBatch("""
CREATE TABLE feedcollections (
feedcollection_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
+ group_id INT NOT NULL REFERENCES groups(group_id) ON DELETE CASCADE,
name VARCHAR,
update_interval INT
)
import de.unixwork.ui.Document
-class FeedCollection(name: String) : Document() {
+class FeedCollection(id: Int, name: String) : Document() {
+ val id = id
val name = name
val items = list<Item>("items")
}
\ No newline at end of file
--- /dev/null
+package de.unixwork.rssreader
+
+class FeedGroup(id: Int, name: String) {
+ val id = id
+ val name: String = name
+}
\ No newline at end of file