Files
njts-accounting-core/backend/sql/add_line_description.sql
2026-03-04 00:35:51 +09:00

25 lines
1001 B
SQL

-- ============================================================================
-- マイグレーション: journal_lines テーブルに line_description カラム追加
-- 実行方法: admin または postgres 超级用户で実行
-- psql -h 192.168.0.61 -p 55432 -U admin -d njts_acct -f add_line_description.sql
-- ============================================================================
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'journal_lines' AND column_name = 'line_description'
) THEN
ALTER TABLE journal_lines ADD COLUMN line_description TEXT;
RAISE NOTICE '✓ line_description カラムを journal_lines に追加しました';
ELSE
RAISE NOTICE '✓ line_description カラムはすでに存在しています';
END IF;
END $$;
-- 確認
SELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_name = 'journal_lines'
ORDER BY ordinal_position;