Modelo Inicial

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

l

l
default layout 9-02-2023 by DbSchema.com - Wise Coders

ia
ia

Tr
Tr

ma
ma
custumers

he
he
id serial

Sc
Sc
person_id integer

Db
Db
customer_since date
created_at timestamp
employees
This is a layout - a diagram with tools. updated_at timestamp
- Create new entities by right-clicking the layout. discount_rate numeric(10,6) id serial
- Double-click entity headers to edit. credit_limit numeric(18,6) person_id integer
notes varchar(2000) occupation_id integer
- For a better understanding of the schema, create multiple layouts.
setor_id integer
- Deploy the model into the database by converting it first to the physical design. registration varchar(15)
updated_at timestamp
created_at timestamp
dt_admission date
physical_person
dt_resignation date
id serial ctps_num varchar(15)
person_id integer ctps_serie varchar(10)
educational_level integer ctps_dt_issue date
persons
marital_status_id integer ctps_uf char(2)
cpf varchar(11) id serial notes varchar(2000)

al
rg varchar(12) name varchar(250)

ia

i
rg_issuer varchar(12) type char(1)

Tr

Tr
rg_dt_issue date site varchar(200)
dt_birth date email varchar(200)
ma

ma
gender char(1) custumer char(1)
Del(C)Upd(C)
nationality varchar(50) employee char(1)
he

he
companies
naturalness varchar(50) supplier char(1)
Sc

Sc
id serial
Db

Db
person_id integer
cnpj varchar(14)
trading_name varchar(100)
registration_state varchar(40)
registration_municipal varchar(40)
dt_incorporation date
person_address
id serial
person_id integer
person_contacts
street varchar(150)
number varchar(10) id serial
neighborhood varchar(100) person_id integer
departments
city integer occupation_id integer
uf char(2) contact_title varchar(50) id serial
zip_code varchar(8) phone_type char(1) company_id integer
complement varchar(150) phone_ddd char(2) name varchar(100)
main char(1) phone_number varchar(9) departament_parent integer
delivery char(1) email varchar(100) initials varchar(10)
correspondence char(1) created_at timestamp created_at timestamp
billing char(1) updated_at timestamp updated_at timestamp
default layout

Table companies
pessoa juridica
* Pk id serial pk da tabela
person_id integer
* cnpj varchar(14) cnpj da empresa sem formatação somente numeros | ex: 37.890.059/0001-02 ,
37890059000102
* trading_name varchar(100) Nome Fantasia
registration_state varchar(40) inscricao estadual ex: 605279322,0778872900178,311360628800
registration_municipal varchar(40) inscricao municipal
dt_incorporation date Date de constituição da empresa
Indexes
Pk pk_company id
Foreign Keys
fk_company_person ( person_id ) ref persons ( id )

Table custumers
Tabela de Clientes
* Pk id serial
person_id integer
customer_since date Cliente desde
created_at timestamp Data de Criação do registro
updated_at timestamp data de atualização do registro
discount_rate numeric(10,6)
credit_limit numeric(18,6)
notes varchar(2000) Observações
Indexes
Pk pk_custumers id
Foreign Keys
fk_custumers_persons ( person_id ) ref persons ( id )

Table departments
pessoa juridica
* Pk id serial pk da tabela
* company_id integer
* Unq name varchar(100) nome do setor ou departameno
departament_parent integer
Table departments
initials varchar(10) Sigla do setor / departamento
* created_at timestamp
* updated_at timestamp
Indexes
Pk pk_company_0 id
Unq unq_departments name
Foreign Keys
fk_departments_companies ( company_id ) ref companies ( id )

Table employees
funcionarios / colaboradores
* Pk id serial
person_id integer
occupation_id integer id do cargo do funcionario
setor_id integer
registration varchar(15) Matricula do funcionario
updated_at timestamp
created_at timestamp
dt_admission date
dt_resignation date data de demissão / desligamento
ctps_num varchar(15) número da carteira de Trabalho
ctps_serie varchar(10) número de série da carteira de Trabalho
ctps_dt_issue date data de expedição do documento
ctps_uf char(2) estado de emissão
notes varchar(2000) observações aqui neste campo
Indexes
Pk pk_employees id
Foreign Keys
fk_employees_persons ( person_id ) ref persons ( id )

Table person_address
* Pk id serial
person_id integer
street varchar(150) Nome da rua
number varchar(10) numero da casa , apt, predio, etc
neighborhood varchar(100) Bairro
* city integer Municipio referente ao IBGE ( API )
Table person_address
* uf char(2) Sigla da Cidade (CE )
zip_code varchar(8) CEP ex: 60125785
complement varchar(150) parte complementar ao endereço
main char(1) Identifica se esse é o endereço principal
delivery char(1) identifica se é o endereço de entrega
correspondence char(1)
billing char(1) identifica se é o endereço de Cobranca
Indexes
Pk pk_person_addrress id
Foreign Keys
fk_person_addrress_person ( person_id ) ref persons ( id )

Table person_contacts
* Pk id serial
person_id integer
occupation_id integer id do cargo do contato
contact_title varchar(50) nome ou identificação para o contato
phone_type char(1)
phone_ddd char(2) ddd da região
phone_number varchar(9)
Unq email varchar(100) email do contato
created_at timestamp data de cadastro
updated_at timestamp Data de atualização
Indexes
Pk pk_person_addrress_0 id
Unq unq_person_contacts_email email
Foreign Keys
fk_person_addrress_person_0 ( person_id ) ref persons ( id )

Table persons
Guarda as informações da Pessoa
* Pk id serial identificador unico
* name varchar(250) nome da pessoa fisica ou razao social
type char(1)
site varchar(200)
email varchar(200)
custumer char(1) Cliente
Table persons
* employee char(1) Especifica se é Funcionario
supplier char(1) Fornecedor
Indexes
Pk pk_person id

Table physical_person
pesoa fisica
* Pk id serial
* person_id integer
* educational_level integer Nivel de Formação escolar ( graduado, pós-graduado, etc
marital_status_id integer
* Unq cpf varchar(11)
Unq rg varchar(12)
rg_issuer varchar(12) orgão emissor
rg_dt_issue date Data de emissão do documento
dt_birth date
gender char(1)
nationality varchar(50)
naturalness varchar(50)
Indexes
Pk physical_person_pkey id
Unq cpf_uniq_key cpf
Unq unq_rg_physical_person rg
Foreign Keys
fk_physical_person ( person_id ) ref persons ( id )

You might also like