@fourlights/strapi-plugin-deep-populate 1.2.2 → 1.2.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/dist/server/index.js +8 -8
- package/dist/server/index.mjs +8 -8
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -65,7 +65,7 @@ const schema$1 = {
|
|
|
65
65
|
type: "json",
|
|
66
66
|
configurable: false
|
|
67
67
|
},
|
|
68
|
-
dependencies: { type: "
|
|
68
|
+
dependencies: { type: "text", configurable: false }
|
|
69
69
|
},
|
|
70
70
|
// experimental feature:
|
|
71
71
|
indexes: [
|
|
@@ -140,13 +140,13 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
140
140
|
const tableName = "caches";
|
|
141
141
|
const columnName = "dependencies";
|
|
142
142
|
const hasIndex = await hasDeepPopulateCacheFullTextIndex(strapi2.db, tableName, columnName);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
const hasTable = await strapi2.db.connection.schema.hasTable(tableName);
|
|
144
|
+
const hasColumn = hasTable && await strapi2.db.connection.schema.hasColumn(tableName, columnName);
|
|
145
|
+
const cacheIsEnabled = strapi2.config.get("plugin::deep-populate").cachePopulate === true;
|
|
146
|
+
const shouldCreateIndex = cacheIsEnabled && hasTable && hasColumn && !hasIndex;
|
|
147
|
+
const shouldRemoveIndex = hasIndex && (!cacheIsEnabled || !hasTable || !hasColumn);
|
|
148
|
+
if (shouldCreateIndex) await addDeepPopulateCacheFullTextIndex(strapi2.db, tableName, columnName);
|
|
149
|
+
if (shouldRemoveIndex) await removeDeepPopulateCacheFullTextIndex(strapi2.db, tableName, columnName);
|
|
150
150
|
});
|
|
151
151
|
strapi2.documents.use(async (context, next) => {
|
|
152
152
|
const { cachePopulate, augmentPopulateStar } = strapi2.config.get("plugin::deep-populate");
|
package/dist/server/index.mjs
CHANGED
|
@@ -51,7 +51,7 @@ const schema$1 = {
|
|
|
51
51
|
type: "json",
|
|
52
52
|
configurable: false
|
|
53
53
|
},
|
|
54
|
-
dependencies: { type: "
|
|
54
|
+
dependencies: { type: "text", configurable: false }
|
|
55
55
|
},
|
|
56
56
|
// experimental feature:
|
|
57
57
|
indexes: [
|
|
@@ -126,13 +126,13 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
126
126
|
const tableName = "caches";
|
|
127
127
|
const columnName = "dependencies";
|
|
128
128
|
const hasIndex = await hasDeepPopulateCacheFullTextIndex(strapi2.db, tableName, columnName);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
const hasTable = await strapi2.db.connection.schema.hasTable(tableName);
|
|
130
|
+
const hasColumn = hasTable && await strapi2.db.connection.schema.hasColumn(tableName, columnName);
|
|
131
|
+
const cacheIsEnabled = strapi2.config.get("plugin::deep-populate").cachePopulate === true;
|
|
132
|
+
const shouldCreateIndex = cacheIsEnabled && hasTable && hasColumn && !hasIndex;
|
|
133
|
+
const shouldRemoveIndex = hasIndex && (!cacheIsEnabled || !hasTable || !hasColumn);
|
|
134
|
+
if (shouldCreateIndex) await addDeepPopulateCacheFullTextIndex(strapi2.db, tableName, columnName);
|
|
135
|
+
if (shouldRemoveIndex) await removeDeepPopulateCacheFullTextIndex(strapi2.db, tableName, columnName);
|
|
136
136
|
});
|
|
137
137
|
strapi2.documents.use(async (context, next) => {
|
|
138
138
|
const { cachePopulate, augmentPopulateStar } = strapi2.config.get("plugin::deep-populate");
|
package/package.json
CHANGED