Add default values for the database columns
This commit is contained in:
@@ -5,8 +5,12 @@
|
||||
template <typename T>
|
||||
struct Column
|
||||
{
|
||||
Column(T default_value):
|
||||
value{default_value} {}
|
||||
Column():
|
||||
value{} {}
|
||||
using real_type = T;
|
||||
T value;
|
||||
T value{};
|
||||
};
|
||||
|
||||
struct Id: Column<std::size_t> { static constexpr auto name = "id_";
|
||||
|
||||
@@ -49,10 +49,12 @@ class Database
|
||||
static constexpr auto options = ""; };
|
||||
|
||||
struct Ports: Column<std::string> { static constexpr auto name = "tlsPorts_";
|
||||
static constexpr auto options = ""; };
|
||||
static constexpr auto options = "";
|
||||
Ports(): Column<std::string>("6667") {}};
|
||||
|
||||
struct TlsPorts: Column<std::string> { static constexpr auto name = "ports_";
|
||||
static constexpr auto options = ""; };
|
||||
static constexpr auto options = "";
|
||||
TlsPorts(): Column<std::string>("6697;6670") {} };
|
||||
|
||||
struct Username: Column<std::string> { static constexpr auto name = "username_";
|
||||
static constexpr auto options = ""; };
|
||||
@@ -73,16 +75,20 @@ class Database
|
||||
static constexpr auto options = ""; };
|
||||
|
||||
struct MaxHistoryLength: Column<int> { static constexpr auto name = "maxHistoryLength_";
|
||||
static constexpr auto options = ""; };
|
||||
static constexpr auto options = "";
|
||||
MaxHistoryLength(): Column<int>(20) {} };
|
||||
|
||||
struct RecordHistory: Column<bool> { static constexpr auto name = "recordHistory_";
|
||||
static constexpr auto options = ""; };
|
||||
static constexpr auto options = "";
|
||||
RecordHistory(): Column<bool>(true) {}};
|
||||
|
||||
struct VerifyCert: Column<bool> { static constexpr auto name = "verifyCert_";
|
||||
static constexpr auto options = ""; };
|
||||
static constexpr auto options = "";
|
||||
VerifyCert(): Column<bool>(true) {} };
|
||||
|
||||
struct Persistent: Column<bool> { static constexpr auto name = "persistent_";
|
||||
static constexpr auto options = ""; };
|
||||
static constexpr auto options = "";
|
||||
Persistent(): Column<bool>(false) {} };
|
||||
|
||||
using MucLogLineTable = Table<Id, Uuid, Owner, IrcChanName, IrcServerName, Date, Body, Nick>;
|
||||
using MucLogLine = MucLogLineTable::RowType;
|
||||
|
||||
Reference in New Issue
Block a user