From 565afa5c7b7b2ff7a1fbb7c098aa852a9c2e8dcc Mon Sep 17 00:00:00 2001
From: Julien Dessaux
Date: Mon, 24 Jul 2023 00:01:49 +0200
Subject: [haskell] embed sql migration scripts from external files

---
 haskell/src/SpaceTraders/Database/000_init.sql | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 haskell/src/SpaceTraders/Database/000_init.sql

(limited to 'haskell/src/SpaceTraders/Database/000_init.sql')

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'));
-- 
cgit v1.2.3

