Skip to content

Commit

Permalink
Add snapshots into schema creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtar committed Nov 2, 2023
1 parent 325a7d6 commit 3a22d34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ object CreateSchema {

val pointer2 = table(config.pointer2Table, a => Nel.of(Pointer2Statements.createTable(a)))

val snapshot = table(config.snapshotTable, a => Nel.of(SnapshotStatements.createTable(a)))

val setting = table(config.settingTable, a => Nel.of(SettingStatements.createTable(a)))

val schema = Schema(
Expand All @@ -55,11 +57,12 @@ object CreateSchema {
metaJournal = tableName(metaJournal),
pointer = tableName(pointer),
pointer2 = tableName(pointer2),
snapshot = tableName(snapshot),
setting = tableName(setting))

if (config.autoCreate) {
for {
result <- createTables(keyspace, Nel.of(journal, pointer, pointer2, setting, metaJournal))
result <- createTables(keyspace, Nel.of(journal, pointer, pointer2, snapshot, setting, metaJournal))
} yield {
(schema, result)
}
Expand All @@ -73,4 +76,4 @@ object CreateSchema {
result <- createTables1
} yield result
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ final case class Schema(
metaJournal: TableName,
pointer: TableName,
pointer2: TableName,
setting: TableName)
snapshot: TableName,
setting: TableName)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ final case class SchemaConfig(
metaJournalTable: String = "metajournal",
pointerTable: String = "pointer",
pointer2Table: String = "pointer2",
snapshotTable: String = "snapshot",
settingTable: String = "setting",
locksTable: String = "locks",
autoCreate: Boolean = true)
Expand All @@ -36,4 +37,4 @@ object SchemaConfig {

implicit val configReaderKeyspace: ConfigReader[Keyspace] = deriveReader
}
}
}

0 comments on commit 3a22d34

Please sign in to comment.