summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-06-18 03:31:22 +0100
committerubq323 <ubq323@ubq323.website>2023-06-18 03:31:22 +0100
commit6ca2cc22977f729fb6e40bdd0f00da4edf3cb777 (patch)
tree04099383c0b1363d0794e24e3aaed09bedc6e5f7 /server
parent1490cf19a950d99b045fe68d7151a6cd54c57e27 (diff)
add script to init db
Diffstat (limited to 'server')
-rw-r--r--server/init_db.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/init_db.lua b/server/init_db.lua
new file mode 100644
index 0000000..c4165f5
--- /dev/null
+++ b/server/init_db.lua
@@ -0,0 +1,14 @@
+local lmdb = require'lmdb'
+local env = assert(lmdb.open('data',{maxdbs=16}))
+local txn = assert(env:txn_begin(true))
+
+local dbs = {
+ 'chunks',
+}
+
+for _,dbname in ipairs(dbs) do
+ assert(txn:open(dbname, true))
+end
+
+txn:commit()
+