mirror of
https://github.com/acedanger/budget-database.git
synced 2025-12-05 22:50:13 -08:00
added support for multiple accounts
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
drop table if exists public.accounts;
|
||||
drop table if exists public.accounts cascade;
|
||||
|
||||
CREATE TABLE public.accounts(
|
||||
acct_id serial,
|
||||
@@ -6,14 +6,20 @@ CREATE TABLE public.accounts(
|
||||
account_type varchar(50) not null,
|
||||
account_number varchar(20) null,
|
||||
friendly_name varchar(50) null,
|
||||
insert_dt_tm timestamp default now(),
|
||||
insert_dt_tm timestamp null default now(),
|
||||
PRIMARY KEY( acct_id )
|
||||
);
|
||||
|
||||
INSERT INTO public.accounts (bank_name, account_type, friendly_name) values
|
||||
('Bank of America', 'Checking', 'Joint Checking')
|
||||
, ('Ally', 'Savings', 'Joint Savings')
|
||||
, ('Ally', 'Savings', 'Vacation Savings')
|
||||
-- Permissions
|
||||
|
||||
select * from public.accounts a
|
||||
ALTER TABLE public.accounts OWNER TO acedanger;
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user