Files
njts-accounting-core/backend/sql/add_tax_year.sql
2026-01-20 11:15:49 +09:00

18 lines
521 B
SQL
Raw 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.
-- 所得税率表に年度フィールドを追加
ALTER TABLE income_tax_table
ADD COLUMN tax_year INTEGER;
-- 既存データに年度を設定valid_fromから抽出
UPDATE income_tax_table
SET tax_year = EXTRACT(YEAR FROM valid_from);
-- 年度をNOT NULLに変更
ALTER TABLE income_tax_table
ALTER COLUMN tax_year SET NOT NULL;
-- インデックスを追加
CREATE INDEX idx_income_tax_year ON income_tax_table(tax_year);
-- コメント
COMMENT ON COLUMN income_tax_table.tax_year IS '適用年度';