summaryrefslogtreecommitdiff
path: root/src/database
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-06-13 11:18:05 +0200
committerlouiz’ <louiz@louiz.org>2017-06-14 00:19:15 +0200
commit369ccb037619871403b14c959bbb359332133810 (patch)
tree559d64437c302c306aade66486fac33ef6320d2a /src/database
parent50cadf3dac0d56ef8181d1800cc30f8dcb749141 (diff)
downloadbiboumi-369ccb037619871403b14c959bbb359332133810.tar.gz
biboumi-369ccb037619871403b14c959bbb359332133810.tar.bz2
biboumi-369ccb037619871403b14c959bbb359332133810.tar.xz
biboumi-369ccb037619871403b14c959bbb359332133810.zip
Add default values for the database columns
Diffstat (limited to 'src/database')
-rw-r--r--src/database/column.hpp6
-rw-r--r--src/database/database.hpp18
2 files changed, 17 insertions, 7 deletions
diff --git a/src/database/column.hpp b/src/database/column.hpp
index e74d426..22f4254 100644
--- a/src/database/column.hpp
+++ b/src/database/column.hpp
@@ -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_";
diff --git a/src/database/database.hpp b/src/database/database.hpp
index ebc4878..a0611c1 100644
--- a/src/database/database.hpp
+++ b/src/database/database.hpp
@@ -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;