@sprucelabs/postgres-data-store 3.0.7 → 3.0.8

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.
@@ -164,7 +164,7 @@ class PostgresDatabase {
164
164
  AND table_type = 'BASE TABLE';
165
165
  `);
166
166
  const tableNames = res.rows.map((row) => row.table_name);
167
- await Promise.all(tableNames.map((tableName) => this.client.query(`TRUNCATE TABLE public.${tableName} RESTART IDENTITY CASCADE`)));
167
+ await Promise.all(tableNames.map((tableName) => this.client.query(`TRUNCATE TABLE "${tableName}" RESTART IDENTITY CASCADE`)));
168
168
  }
169
169
  async createOne(collection, values) {
170
170
  const rows = await this.create(collection, [values]);
@@ -306,7 +306,7 @@ class PostgresDatabase {
306
306
  var _a, _b;
307
307
  const indexName = this.generateIndexName(collection, fields);
308
308
  const keys = this.generateKeyExpressions(fields);
309
- const query = `CREATE ${isUnique ? `UNIQUE` : ''} INDEX ${indexName} ON public.${collection} (${keys})`;
309
+ const query = `CREATE ${isUnique ? `UNIQUE` : ''} INDEX ${indexName} ON "${collection}" (${keys})`;
310
310
  try {
311
311
  await this.client.query({
312
312
  text: query,
@@ -179,7 +179,7 @@ export default class PostgresDatabase {
179
179
  AND table_type = 'BASE TABLE';
180
180
  `);
181
181
  const tableNames = res.rows.map((row) => row.table_name);
182
- yield Promise.all(tableNames.map((tableName) => this.client.query(`TRUNCATE TABLE public.${tableName} RESTART IDENTITY CASCADE`)));
182
+ yield Promise.all(tableNames.map((tableName) => this.client.query(`TRUNCATE TABLE "${tableName}" RESTART IDENTITY CASCADE`)));
183
183
  });
184
184
  }
185
185
  createOne(collection, values) {
@@ -345,7 +345,7 @@ export default class PostgresDatabase {
345
345
  return __awaiter(this, void 0, void 0, function* () {
346
346
  const indexName = this.generateIndexName(collection, fields);
347
347
  const keys = this.generateKeyExpressions(fields);
348
- const query = `CREATE ${isUnique ? `UNIQUE` : ''} INDEX ${indexName} ON public.${collection} (${keys})`;
348
+ const query = `CREATE ${isUnique ? `UNIQUE` : ''} INDEX ${indexName} ON "${collection}" (${keys})`;
349
349
  try {
350
350
  yield this.client.query({
351
351
  text: query,
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "sprucebot",
23
23
  "sprucelabs"
24
24
  ],
25
- "version": "3.0.7",
25
+ "version": "3.0.8",
26
26
  "scripts": {
27
27
  "build.ci": "yarn build.tsc && yarn build.resolve-paths && yarn lint",
28
28
  "build.dev": "yarn build.tsc --sourceMap ; yarn resolve-paths.lint",