链接指定数据库 “xs_crm”
> psql -h 127.0.0.1 -U postgres -d xs_crm
退出psql
> \q
切换数据库
> \c databaseName
查看帮助
> \ ?
查看数据库列表
> \l 或 \l+
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges | Size | Tablespace | Description
---------------------------+----------+----------+-------------+-------------+-----------------------+---------+------------+--------------------------------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 6804 kB | pg_default | default administrative connection database
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres | 6681 kB | pg_default | unmodifiable empty database
: postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres | 6689 kB | pg_default | default template for new databases
: postgres=CTc/postgres
xs_address | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 55 MB | pg_default |
xs_backoffice | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 7116 kB | pg_default |
xs_code_release | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 7068 kB | pg_default |
xs_company | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 7252 kB | pg_default |
xs_crm | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 16 MB | pg_default |
xs_hbird_agent | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 9332 kB | pg_default |
xs_hefs | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 8028 kB | pg_default |
xs_job | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 8084 kB | pg_default |
xs_operation | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 6964 kB | pg_default |
xs_passport_internal | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 7292 kB | pg_default |
xs_public_account_backend | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 7252 kB | pg_default |
xs_static_resource | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 7036 kB | pg_default |
(15 rows)
查看合同所有表结构
> \d+ contract.*
查看合同主表
> \d+ contract.contract_main
xs_crm-# \d+ contract.contract_main
Table "contract.contract_main"
Column | Type | Modifiers | Storage | Description
-----------------------+------------------------+------------------------------------------------------------------------------+----------+----------------------------------------------------------
contract_id | integer | not null default nextval('contract.contract_main_contract_id_seq'::regclass) | plain | 合同标识
contract_relation_id | integer | not null default 0 | plain | 所属关联合同
contract_number | character(14) | not null default ''::bpchar | extended | 合同编号
client_id | integer | not null default 0 | plain | 客户标识
company_id | integer | not null default 0 | plain | 企业标识: 关联《系统-企业主表》的`company_id`字段
type | smallint | not null default 0 | plain | 合同类型: 1 分时就业,2 集中就业
status | smallint | not null default 0 | plain | 合同状态: 1 合同签约,2 合同履约,3 合同到期,4 合同作废
status_arrange | smallint | not null default 0 | plain | 安置状态: 1 未安置,2 安置中,3 安置完成
status_money | smallint | not null default 0 | plain | 回款状态: 1 未回款,2 部分回款,3 回款完成
money | integer | not null default 0 | plain | 合同金额: 实际金额×100
money_received | integer | not null default 0 | plain | 回款金额: 实际金额×100
number_required | integer | not null default 0 | plain | 需要残障者人月
number_arranged | integer | not null default 0 | plain | 已安排残障者人月
time_start | integer | not null default 0 | plain | 合同开始时间
time_end | integer | not null default 0 | plain | 合同结束时间
complete_time | integer | not null default 0 | plain | 完成时间
comment | character varying(512) | not null default ''::character varying | extended | 备注
reason_close | character varying(256) | not null default ''::character varying | extended | 关闭原因
number_job | smallint | not null default 0 | plain | 职位数量
number_contract_image | smallint | not null default 0 | plain | 合同图片数量
add_user_id | integer | not null default 0 | plain | 添加人
add_time | integer | not null default 0 | plain | 添加时间
add_ip | character varying(15) | not null default ''::character varying | extended | 添加IP
update_user_id | integer | not null default 0 | plain | 更新人
update_time | integer | not null default 0 | plain | 修改时间
update_ip | character varying(15) | not null default ''::character varying | extended | 修改IP
共和国长谷川国产车