# 1.登录PostgresSQL
psql -U postgres
# 2.使用\l查看都有PG当中都有哪些DB
dify=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-------------+----------+----------+------------+------------+------------+-----------------+-----------------------
dify | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
dify_plugin | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc |
template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
(5 rows)
# 3.使用'\c dify'命令切换到Dify DB下
postgres=# \c dify
You are now connected to database "dify" as user "postgres".
# 4.使用\dt命令查看都有哪些表
dify=# \dt
List of relations
Schema | Name | Type | Owner
--------+---------------------------------------+-------+----------
public | account_integrates | table | postgres
public | account_plugin_permissions | table | postgres
public | accounts | table | postgres
public | alembic_version | table | postgres
public | api_based_extensions | table | postgres
public | api_requests | table | postgres
public | api_tokens | table | postgres
public | app_annotation_hit_histories | table | postgres
public | app_annotation_settings | table | postgres
public | app_dataset_joins | table | postgres
public | app_mcp_servers | table | postgres
public | app_model_configs | table | postgres
public | apps | table | postgres
public | celery_taskmeta | table | postgres
public | celery_tasksetmeta | table | postgres
public | child_chunks | table | postgres
public | conversations | table | postgres
public | data_source_api_key_auth_bindings | table | postgres
public | data_source_oauth_bindings | table | postgres
--More--
# 5.使用'\d accounts'查看账户表的结构, 使用'\d tenants'查看Workspace租户表的结构
dify=# \d tenants
Table "public.tenants"
Column | Type | Collation | Nullable | Default
--------------------+-----------------------------+-----------+----------+-----------------------------
id | uuid | | not null | uuid_generate_v4()
name | character varying(255) | | not null |
encrypt_public_key | text | | |
plan | character varying(255) | | not null | 'basic'::character varying
status | character varying(255) | | not null | 'normal'::character varying
created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP(0)
updated_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP(0)
custom_config | text | | |
Indexes:
"tenant_pkey" PRIMARY KEY, btree (id)
# 6.使用'select * from tenants;'查看租户信息
接着,参考如下的文档进行操作:https://www.jansora.com/notebook/107676。
评论