0% found this document useful (0 votes)
54 views

Tables - Diagram in Dbdiagram

The document defines the schema for a database with tables for countries, states, cities, customers, accounts, transactions, investments, and date dimensions. The tables are linked through foreign key relationships - for example, the customers table links to the city table, and the transactions tables link to the accounts table. Date dimensions such as time, month, week, and weekday are also defined and linked to transaction tables for temporal data.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Tables - Diagram in Dbdiagram

The document defines the schema for a database with tables for countries, states, cities, customers, accounts, transactions, investments, and date dimensions. The tables are linked through foreign key relationships - for example, the customers table links to the city table, and the transactions tables link to the accounts table. Date dimensions such as time, month, week, and weekday are also defined and linked to transaction tables for temporal data.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Table country as U {

country_id uuid [pk]


country varchar(128)
}

Table state as U {
state_id uuid [pk]
state varchar(128)
country_id uuid
}

Table city as U {
city_id int [pk]
city varchar(256)
state_id uuid
}

Table customers as U {
customer_id uuid [pk]
first_name varchar(128)
last_name varchar(128)
customer_city int
country_name varchar(128)
cpf int
}

Table accounts as U {
account_id uuid [pk]
customer_id uuid
created_at timestamp
status varchar(128)
account_branch varchar(128)
account_check_digit varchar(128)
account_number varchar(128)
}

Table transfer_ins as U {
id uuid [pk]
account_id uuid
amount float
transaction_requested_at int
transaction_completed_at int
status varchar(128)
}

Table transfer_outs as U {
id uuid [pk]
account_id uuid
amount float
transaction_requested_at int
transaction_completed_at int
status varchar(128)
}
Table pix_movements as U {
id uuid [pk]
account_id uuid
in_or_out varchar(128)
pix_amount float
pix_requested_at int
pix_completed_at int
status varchar(128)
}

Table investments as U {
transaction_id uuid [pk]
account_id uuid
type varchar(128)
amount float
investment_requested_at int
investment_completed_at int
status varchar(128)
}

Table d_month as U {
month_id int [pk]
action_month int
}

Table d_year as U {
year_id int [pk]
action_year int
}

Table d_time as U {
time_id int [pk]
action_timestamp timestamp
week_id int
month_id int
year_id int
weekday_id int
}

Table d_week as U {
week_id int [pk]
action_week int
}

Table d_weekday as U {
weekday_id int [pk]
action_weekday varchar(128)
}

Ref: state.country_id > country.country_id


Ref: city.state_id > state.state_id

Ref: customers.customer_city > city.city_id


Ref: accounts.customer_id - customers.customer_id

Ref: transfer_ins.account_id > accounts.account_id


Ref: transfer_outs.account_id > accounts.account_id
Ref: pix_movements.account_id > accounts.account_id

Ref: investments.account_id > accounts.account_id

Ref: investments.investment_requested_at > d_time.time_id


Ref: investments.investment_completed_at > d_time.time_id

Ref: transfer_outs.transaction_requested_at > d_time.time_id


Ref: transfer_outs.transaction_completed_at > d_time.time_id

Ref: transfer_ins.transaction_requested_at > d_time.time_id


Ref: transfer_ins.transaction_completed_at > d_time.time_id

Ref: pix_movements.pix_requested_at > d_time.time_id


Ref: pix_movements.pix_completed_at > d_time.time_id

Ref: d_time.week_id > d_week.week_id


Ref: d_time.month_id > d_month.month_id
Ref: d_time.year_id > d_year.year_id
Ref: d_time.weekday_id > d_weekday.weekday_id

You might also like