refactor SQL scripts for consistency and style improvements

This commit is contained in:
Peter Wood
2025-03-06 08:26:39 -05:00
parent b6a6ca3b38
commit 07b8185c35
10 changed files with 192 additions and 168 deletions

View File

@@ -1,21 +1,19 @@
-- public.budgetdetails definition
-- Drop table
DROP table if exists public.budgetdetails cascade;
drop table if exists public.budgetdetails cascade;
CREATE TABLE public.budgetdetails (
trx_id uuid NOT NULL DEFAULT uuid_generate_v4(),
trx_description text NOT NULL,
trx_date date NOT NULL,
trx_amount numeric NOT NULL,
acct_id int NULL,
insert_dt_tm timestamp NULL DEFAULT now(),
primary key ( trx_id ),
constraint fk_acct foreign key ( acct_id ) references public.accounts(acct_id) on delete set null
create table public.budgetdetails (
trx_id uuid not null default uuid_generate_v4 (),
trx_description text not null,
trx_date date not null,
trx_amount numeric not null,
acct_id int null,
created_at timestamp null default now(),
primary key (trx_id),
constraint fk_acct foreign key (acct_id) references public.accounts (acct_id) on delete set null
);
-- Permissions
ALTER TABLE public.budgetdetails OWNER TO acedanger;
GRANT ALL ON TABLE public.budgetdetails TO acedanger;
GRANT ALL ON TABLE public.budgetdetails TO budgetuser;
alter table public.budgetdetails OWNER to acedanger;
grant all on table public.budgetdetails to acedanger;
grant all on table public.budgetdetails to budgetuser;