summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Database
diff options
context:
space:
mode:
Diffstat (limited to 'haskell/src/SpaceTraders/Database')
-rw-r--r--haskell/src/SpaceTraders/Database/000_init.sql25
1 files changed, 25 insertions, 0 deletions
diff --git a/haskell/src/SpaceTraders/Database/000_init.sql b/haskell/src/SpaceTraders/Database/000_init.sql
new file mode 100644
index 0000000..78a62cd
--- /dev/null
+++ b/haskell/src/SpaceTraders/Database/000_init.sql
@@ -0,0 +1,25 @@
+CREATE TABLE schema_version (
+ version INTEGER NOT NULL
+);
+CREATE TABLE tokens (
+ id INTEGER PRIMARY KEY,
+ data TEXT NOT NULL
+);
+CREATE TABLE agents (
+ id INTEGER PRIMARY KEY,
+ data TEXT NOT NULL
+);
+CREATE TABLE contracts (
+ id INTEGER PRIMARY KEY,
+ data TEXT NOT NULL
+);
+CREATE TABLE ships (
+ id INTEGER PRIMARY KEY,
+ data TEXT NOT NULL
+);
+CREATE UNIQUE INDEX ships_data_symbol ON ships (json_extract(data, '$.symbol'));
+CREATE TABLE systems (
+ id INTEGER PRIMARY KEY,
+ data TEXT NOT NULL
+);
+CREATE UNIQUE INDEX systems_data_symbol ON systems (json_extract(data, '$.symbol'));