Files
Card-data-sorting/database.rules

44 lines
1.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# データベースルール
生データrawは絶対編集しない必要なら別カラムに正規化結果
人間が触るのは transactionsだけ
分離は owner_type を1カラムで固定company/personal/pending
“削除”じゃなく “取り消しフラグ” (後で監査・巻き戻しが効く)
# 作ったもの
CREATE USER account_user WITH PASSWORD 'account_Hideyukey-1234';
CREATE DATABASE accounting_db OWNER account_user ENCODING 'UTF8';
postgres=# CREATE DATABASE accounting OWNER account_user ENCODING 'UTF8';
CREATE DATABASE
postgres=# GRANT CONNECT ON DATABASE accounting TO account_user;
GRANT
root@x85-131-243-202:~# sudo -u postgres psql -c "\du"
List of roles
Role name | Attributes
---------------+------------------------------------------------------------
account_user |
ai_ocr |
appsmith_user |
cerberus_user |
filemaker | Create DB
gitea_user |
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS
president |
source .venv/bin/activate
DB_NAME=accounting DB_USER=account_user DB_PASSWORD=account_Hideyukey-1234 DB_HOST=labo.sunamura-llc.com DB_PORT=5432 .venv/bin/python manage.py runserver
DJANGO_DEBUG=true DB_NAME=accounting DB_USER=account_user DB_PASSWORD=account_Hideyukey-1234 DB_HOST=labo.sunamura-llc.com DB_PORT=5432 .venv/bin/python manage.py runserver
マイグレーション
DJANGO_DEBUG=true DB_NAME=accounting DB_USER=account_user DB_PASSWORD=account_Hideyukey-1234 DB_HOST=labo.sunamura-llc.com DB_PORT=5432 .venv/bin/python manage.py migrate
または 
set -a; source .env; set +a
python manage.py migrate