initialized database

This commit is contained in:
Jonathan 2024-03-17 16:54:08 -05:00
parent dd40016775
commit 0d9e48752d
3 changed files with 27 additions and 0 deletions

View File

@ -6,6 +6,8 @@ local player = require('player')
local db = require("lapis.db")
local Model = require("lapis.db.model").Model
local db = Model:extend('database')
app:enable("etlua")
app.layout = require "views.layout"
@ -58,5 +60,6 @@ return app

BIN
database.sqlite3 Normal file

Binary file not shown.

24
setup_db Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
sqlite3 database.sqlite3 "
CREATE TABLE IF NOT EXISTS map (
id INTEGER PRIMARY KEY AUTOINCREMENT,
x TEXT,
y TEXT,
occupied_by_type TEXT,
occupied_by_id INTEGER
);
CREATE TABLE IF NOT EXISTS entity_ref (
id INTEGER PRIMARY KEY AUTOINCREMENT,
entity_id INTEGER,
type TEXT,
hp INTEGER,
inventory_ref INTEGER
);
CREATE TABLE IF NOT EXISTS player_inventory (
id INTEGER PRIMARY KEY AUTOINCREMENT,
type TEXT,
quantity INTEGER,
func_ref TEXT
)
"