File tree 2 files changed +17
-2
lines changed 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries (and more).
4
4
5
+ ### Environment variables
6
+ ``` shell
7
+ PG_META_DB_HOST = ${PG_META_DB_HOST}
8
+ PG_META_DB_NAME = ${PG_META_DB_NAME}
9
+ PG_META_DB_USER = ${PG_META_DB_USER}
10
+ PG_META_DB_PASSWORD = ${PG_META_DB_PASSWORD}
11
+ PG_META_DB_PORT = ${PG_META_DB_PORT}
12
+ PG_META_PORT = ${PG_META_PORT}
13
+ ```
14
+
15
+
5
16
## Documentation
6
17
7
18
https://supabase.github.io/postgres-meta/
Original file line number Diff line number Diff line change @@ -91,7 +91,8 @@ export default class PostgresMetaColumns {
91
91
is_unique = false ,
92
92
comment,
93
93
check,
94
- } : {
94
+ foreign_table,
95
+ } : {
95
96
table_id : number
96
97
name : string
97
98
type : string
@@ -103,6 +104,7 @@ export default class PostgresMetaColumns {
103
104
is_primary_key ?: boolean
104
105
is_unique ?: boolean
105
106
comment ?: string
107
+ foreign_table ?: string
106
108
check ?: string
107
109
} ) : Promise < PostgresMetaResult < PostgresColumn > > {
108
110
const { data, error } = await this . metaTables . retrieve ( { id : table_id } )
@@ -126,6 +128,7 @@ export default class PostgresMetaColumns {
126
128
}
127
129
const isPrimaryKeyClause = is_primary_key ? 'PRIMARY KEY' : ''
128
130
const isUniqueClause = is_unique ? 'UNIQUE' : ''
131
+ const foreignClause = foreign_table ? `references ${ ident ( foreign_table ) } ` : '' ;
129
132
const checkSql = check === undefined ? '' : `CHECK (${ check } )`
130
133
const commentSql =
131
134
comment === undefined
@@ -140,7 +143,8 @@ BEGIN;
140
143
${ isNullableClause }
141
144
${ isPrimaryKeyClause }
142
145
${ isUniqueClause }
143
- ${ checkSql } ;
146
+ ${ checkSql }
147
+ ${ foreignClause } ;
144
148
${ commentSql } ;
145
149
COMMIT;`
146
150
{
You can’t perform that action at this time.
0 commit comments