pg-boss 10.0.0-beta8 → 10.0.0-beta9
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 +1 -1
- package/src/plans.js +4 -4
package/package.json
CHANGED
package/src/plans.js
CHANGED
|
@@ -186,7 +186,7 @@ function getPartitionFunction (schema) {
|
|
|
186
186
|
return `
|
|
187
187
|
CREATE FUNCTION ${schema}.get_partition(queue_name text, out name text) AS
|
|
188
188
|
$$
|
|
189
|
-
SELECT '
|
|
189
|
+
SELECT 'job_' || encode(sha224(queue_name::bytea), 'hex');
|
|
190
190
|
$$
|
|
191
191
|
LANGUAGE SQL
|
|
192
192
|
IMMUTABLE
|
|
@@ -201,9 +201,9 @@ function createPartitionFunction (schema) {
|
|
|
201
201
|
DECLARE
|
|
202
202
|
table_name varchar := ${schema}.get_partition(queue_name);
|
|
203
203
|
BEGIN
|
|
204
|
-
EXECUTE format('CREATE TABLE
|
|
205
|
-
EXECUTE format('ALTER TABLE
|
|
206
|
-
EXECUTE format('ALTER TABLE ${schema}.job ATTACH PARTITION
|
|
204
|
+
EXECUTE format('CREATE TABLE ${schema}.%I (LIKE ${schema}.job INCLUDING DEFAULTS INCLUDING CONSTRAINTS)', table_name);
|
|
205
|
+
EXECUTE format('ALTER TABLE ${schema}.%I ADD CHECK (name=%L)', table_name, queue_name);
|
|
206
|
+
EXECUTE format('ALTER TABLE ${schema}.job ATTACH PARTITION ${schema}.%I FOR VALUES IN (%L)', table_name, queue_name);
|
|
207
207
|
END;
|
|
208
208
|
$$
|
|
209
209
|
LANGUAGE plpgsql;
|