From 70304b1903cc5b1accd9caea229e59901384203a Mon Sep 17 00:00:00 2001
From: Masaya Tojo <masaya@tojo.tokyo>
Date: Tue, 28 Mar 2023 01:29:08 +0900
Subject: Add `kakeibo.` prefix.

---
 deploy/kakeibo.items@v1.0.0-alpha.1.sql | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 deploy/kakeibo.items@v1.0.0-alpha.1.sql

(limited to 'deploy/kakeibo.items@v1.0.0-alpha.1.sql')

diff --git a/deploy/kakeibo.items@v1.0.0-alpha.1.sql b/deploy/kakeibo.items@v1.0.0-alpha.1.sql
new file mode 100644
index 0000000..0a43f8b
--- /dev/null
+++ b/deploy/kakeibo.items@v1.0.0-alpha.1.sql
@@ -0,0 +1,18 @@
+-- Deploy kakeibo:items to pg
+-- requires: schema
+-- requires: transactions
+
+BEGIN;
+
+CREATE TABLE kakeibo.items (
+  id SERIAL PRIMARY KEY,
+  transaction_id INTEGER NOT NULL REFERENCES kakeibo.transactions(id) ON DELETE RESTRICT ON UPDATE RESTRICT,
+  category TEXT NOT NULL,
+  subcategory TEXT CHECK (note <> ''),
+  amount INTEGER NOT NULL CHECK (amount > 0),
+  note TEXT CHECK (note <> '') ,
+  created_at TIMESTAMP NOT NULL DEFAULT NOW(),
+  updated_at TIMESTAMP NOT NULL DEFAULT NOW()
+);
+
+COMMIT;
-- 
cgit v1.2.3

