@budibase/server 2.6.19-alpha.2 → 2.6.19-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.6.19-alpha.2",
4
+ "version": "2.6.19-alpha.3",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -45,12 +45,12 @@
45
45
  "license": "GPL-3.0",
46
46
  "dependencies": {
47
47
  "@apidevtools/swagger-parser": "10.0.3",
48
- "@budibase/backend-core": "2.6.19-alpha.2",
49
- "@budibase/client": "2.6.19-alpha.2",
50
- "@budibase/pro": "2.6.19-alpha.2",
51
- "@budibase/shared-core": "2.6.19-alpha.2",
52
- "@budibase/string-templates": "2.6.19-alpha.2",
53
- "@budibase/types": "2.6.19-alpha.2",
48
+ "@budibase/backend-core": "2.6.19-alpha.3",
49
+ "@budibase/client": "2.6.19-alpha.3",
50
+ "@budibase/pro": "2.6.19-alpha.3",
51
+ "@budibase/shared-core": "2.6.19-alpha.3",
52
+ "@budibase/string-templates": "2.6.19-alpha.3",
53
+ "@budibase/types": "2.6.19-alpha.3",
54
54
  "@bull-board/api": "3.7.0",
55
55
  "@bull-board/koa": "3.9.4",
56
56
  "@elastic/elasticsearch": "7.10.0",
@@ -177,5 +177,5 @@
177
177
  "optionalDependencies": {
178
178
  "oracledb": "5.3.0"
179
179
  },
180
- "gitHead": "62e6959d05c2e64f53bb4090b8f714937907efa5"
180
+ "gitHead": "9a3ddfba7931018031a3160c4972119a8bf4a0ac"
181
181
  }
@@ -126,14 +126,15 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
126
126
 
127
127
  COLUMNS_SQL!: string
128
128
 
129
- PRIMARY_KEYS_SQL = `
130
- select tc.table_schema, tc.table_name, kc.column_name as primary_key
131
- from information_schema.table_constraints tc
132
- join
133
- information_schema.key_column_usage kc on kc.table_name = tc.table_name
134
- and kc.table_schema = tc.table_schema
135
- and kc.constraint_name = tc.constraint_name
136
- where tc.constraint_type = 'PRIMARY KEY';
129
+ PRIMARY_KEYS_SQL = () => `
130
+ SELECT pg_namespace.nspname table_schema
131
+ , pg_class.relname table_name
132
+ , pg_attribute.attname primary_key
133
+ FROM pg_class
134
+ JOIN pg_index ON pg_class.oid = pg_index.indrelid AND pg_index.indisprimary
135
+ JOIN pg_attribute ON pg_attribute.attrelid = pg_class.oid AND pg_attribute.attnum = ANY(pg_index.indkey)
136
+ JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
137
+ WHERE pg_namespace.nspname = '${this.config.schema}';
137
138
  `
138
139
 
139
140
  constructor(config: PostgresConfig) {
@@ -239,7 +240,9 @@ class PostgresIntegration extends Sql implements DatasourcePlus {
239
240
  let tableKeys: { [key: string]: string[] } = {}
240
241
  await this.openConnection()
241
242
  try {
242
- const primaryKeysResponse = await this.client.query(this.PRIMARY_KEYS_SQL)
243
+ const primaryKeysResponse = await this.client.query(
244
+ this.PRIMARY_KEYS_SQL()
245
+ )
243
246
  for (let table of primaryKeysResponse.rows) {
244
247
  const tableName = table.table_name
245
248
  if (!tableKeys[tableName]) {