Metabase
This commit is contained in:
18
01_bank.sql
18
01_bank.sql
@@ -8,21 +8,23 @@
|
||||
|
||||
--show shared_preload_libraries;
|
||||
|
||||
--drop schema if exists public cascade;
|
||||
--create schema public;
|
||||
|
||||
create schema if not exists ext;
|
||||
create extension if not exists pgcrypto schema ext;
|
||||
create extension if not exists tablefunc;
|
||||
|
||||
create extension if not exists pg_cron;
|
||||
|
||||
create extension if not exists timescaledb;
|
||||
|
||||
--drop schema if exists public cascade;
|
||||
--create schema public;
|
||||
|
||||
create type holder_type as enum ('BANK', 'PERSON', 'COMPANY');
|
||||
|
||||
create table holder (
|
||||
"id" bigint primary key generated always as identity,
|
||||
"type" holder_type not null,
|
||||
"created_at" timestamp not null default current_timestamp
|
||||
"created_at" timestamptz not null default current_timestamp
|
||||
);
|
||||
|
||||
/************************************************************************
|
||||
@@ -278,7 +280,7 @@ create table account_holder (
|
||||
|
||||
create table transaction (
|
||||
"id" bigint primary key generated always as identity,
|
||||
"transaction_date" timestamp not null default current_timestamp,
|
||||
"transaction_date" timestamptz not null default current_timestamp,
|
||||
amount decimal not null check (amount > 0)
|
||||
);
|
||||
|
||||
@@ -421,9 +423,9 @@ call add_account('EUR', array[1], array[1]);
|
||||
call add_account('USD', array[1], array[1]);
|
||||
call add_account('JPY', array[1], array[1]);
|
||||
|
||||
update account set balance = 100000 where id = 1;
|
||||
update account set balance = 50000 where id = 2;
|
||||
update account set balance = 2000000 where id = 3;
|
||||
update account set balance = 100 where id = 1;
|
||||
update account set balance = 500 where id = 2;
|
||||
update account set balance = 200 where id = 3;
|
||||
|
||||
call add_account('EUR', array[2, 3], array[0.6, 0.4]);
|
||||
|
||||
|
||||
23
02_metabase.sql
Normal file
23
02_metabase.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
create role metabase_user with
|
||||
login
|
||||
nosuperuser
|
||||
nocreatedb
|
||||
nocreaterole
|
||||
noinherit
|
||||
noreplication
|
||||
connection limit -1
|
||||
password 'supermotdepasse';
|
||||
|
||||
create database metabase
|
||||
with owner metabase_user;
|
||||
|
||||
grant connect on database metabase to metabase_user;
|
||||
|
||||
|
||||
grant usage
|
||||
on schema public
|
||||
to metabase_user;
|
||||
|
||||
grant select on all tables
|
||||
in schema public
|
||||
to metabase_user;
|
||||
Reference in New Issue
Block a user