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,25 +1,38 @@
drop table if exists public.accounts cascade;
CREATE TABLE public.accounts(
acct_id serial,
acct_bank_name varchar(50) not null,
acct_type varchar(50) not null,
acct_number varchar(20) null,
acct_friendly_name varchar(50) null,
insert_dt_tm timestamp null default now(),
PRIMARY KEY( acct_id )
create table public.accounts (
acct_id serial,
acct_bank_name varchar(50) not null,
acct_type varchar(50) not null,
acct_number varchar(20) null,
acct_friendly_name varchar(50) null,
created_at timestamp null default now(),
primary key (acct_id)
);
-- Permissions
alter table public.accounts OWNER to acedanger;
ALTER TABLE public.accounts OWNER TO acedanger;
GRANT ALL ON TABLE public.accounts TO acedanger;
GRANT ALL ON TABLE public.accounts TO budgetuser;
grant all on table public.accounts to acedanger;
grant all on table public.accounts to budgetuser;
-- Populate table
truncate public.accounts;
INSERT INTO public.accounts (bank_name, account_type, friendly_name, account_number) values
('Bank of America', 'Checking', 'Joint Checking', '4581')
, ('Ally', 'Savings', 'Joint Savings', '9969')
, ('Ally', 'Savings', 'Vacation Savings', '6268')
insert into
public.accounts (
bank_name,
account_type,
friendly_name,
account_number
)
values
(
'Bank of America',
'Checking',
'Joint Checking',
'4581'
),
('Ally', 'Savings', 'Joint Savings', '9969'),
('Ally', 'Savings', 'Vacation Savings', '6268')