diff options
| author | Masaya Tojo <masaya@tojo.tokyo> | 2023-03-13 00:11:31 +0900 | 
|---|---|---|
| committer | Masaya Tojo <masaya@tojo.tokyo> | 2023-03-13 00:17:07 +0900 | 
| commit | 05b6e730fa81a4ec02fbf361967896f0c9f3a2d4 (patch) | |
| tree | e14b724d2a81bd394cb3cf38b86e1671e491bb68 /deploy | |
| parent | aae863e98b35152e8e7c0efe7919dd105c229361 (diff) | |
Add article_id column to transactions table.
Diffstat (limited to 'deploy')
| -rw-r--r-- | deploy/transactions.sql | 13 | ||||
| -rw-r--r-- | deploy/transactions@v1.0.0-alpha.1.sql | 15 | 
2 files changed, 20 insertions, 8 deletions
| diff --git a/deploy/transactions.sql b/deploy/transactions.sql index e37b276..0572a23 100644 --- a/deploy/transactions.sql +++ b/deploy/transactions.sql @@ -1,15 +1,12 @@  -- Deploy kakeibo:transactions to pg  -- requires: schema +-- requires: articles  BEGIN; -CREATE TABLE kakeibo.transactions ( -  id SERIAL PRIMARY KEY, -  type_code INTEGER, -  date DATE NOT NULL, -  note TEXT, -  created_at TIMESTAMP NOT NULL DEFAULT NOW(), -  updated_at TIMESTAMP NOT NULL DEFAULT NOW() -); +ALTER TABLE kakeibo.transactions +  ADD COLUMN article_id INTEGER, +  ADD CONSTRAINT transactions_article_id_fkey +  FOREIGN KEY (article_id) REFERENCES kakeibo.articles (id);  COMMIT; diff --git a/deploy/transactions@v1.0.0-alpha.1.sql b/deploy/transactions@v1.0.0-alpha.1.sql new file mode 100644 index 0000000..e37b276 --- /dev/null +++ b/deploy/transactions@v1.0.0-alpha.1.sql @@ -0,0 +1,15 @@ +-- Deploy kakeibo:transactions to pg +-- requires: schema + +BEGIN; + +CREATE TABLE kakeibo.transactions ( +  id SERIAL PRIMARY KEY, +  type_code INTEGER, +  date DATE NOT NULL, +  note TEXT, +  created_at TIMESTAMP NOT NULL DEFAULT NOW(), +  updated_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +COMMIT; | 
