Initial commit: Organized PTC project structure with .gitignore and README

This commit is contained in:
2026-03-23 14:44:39 +09:00
commit 35ababe236
21 changed files with 8921 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
set search_path = budget_app, public;
create table if not exists staging_ptc_transactions (
id uuid primary key default gen_random_uuid(),
import_batch varchar(50) not null,
source_file_name varchar(255) not null,
source_sheet_name varchar(100) not null default 'Sheet1',
source_row_no integer not null,
transaction_date_raw varchar(50),
transaction_date date,
in_out varchar(20),
account_code_raw varchar(30),
account_name_raw varchar(100),
department_name_raw varchar(100),
vendor_name_raw varchar(200),
project_code_raw varchar(50),
project_type_raw varchar(50),
project_name_raw varchar(200),
description_raw text,
supply_amount_raw varchar(50),
vat_amount_raw varchar(50),
total_amount_raw varchar(50),
remarks_raw text,
supply_amount numeric(18, 2),
vat_amount numeric(18, 2),
total_amount numeric(18, 2),
normalized_transaction_type varchar(20),
load_status varchar(20) not null default 'loaded',
load_error text,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now(),
constraint uq_staging_ptc_row unique (import_batch, source_row_no),
constraint chk_staging_load_status check (load_status in ('loaded', 'mapped', 'error'))
);
create index if not exists idx_staging_ptc_batch on staging_ptc_transactions(import_batch, source_row_no);
create index if not exists idx_staging_ptc_project on staging_ptc_transactions(project_code_raw);
create index if not exists idx_staging_ptc_account on staging_ptc_transactions(account_code_raw);
create index if not exists idx_staging_ptc_department on staging_ptc_transactions(department_name_raw);