more insane but more working version of the job queue constraint
This commit is contained in:
@@ -54,9 +54,5 @@ __PACKAGE__->add_columns(
|
||||
|
||||
__PACKAGE__->set_primary_key("job");
|
||||
|
||||
__PACKAGE__->add_unique_constraint(
|
||||
queued_job => [qw/ device action subaction /],
|
||||
);
|
||||
|
||||
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
||||
1;
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
-- Convert schema '/home/devver/netdisco-ng/Netdisco/bin/../lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-16-PostgreSQL.sql' to '/home/devver/netdisco-ng/Netdisco/bin/../lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-17-PostgreSQL.sql':;
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE admin ADD CONSTRAINT queued_job UNIQUE (device, action, subaction);
|
||||
CREATE UNIQUE INDEX jobs_queued ON admin (
|
||||
action,
|
||||
coalesce(subaction, '_x_'),
|
||||
coalesce(device, '255.255.255.255'),
|
||||
coalesce(port, '_x_')
|
||||
) WHERE status = 'queued';
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
@@ -21,9 +21,15 @@ CREATE TABLE "admin" (
|
||||
"log" text,
|
||||
"debug" boolean,
|
||||
PRIMARY KEY ("job"),
|
||||
CONSTRAINT "queued_job" UNIQUE ("device", "action", "subaction")
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX jobs_queued ON admin (
|
||||
action,
|
||||
coalesce(subaction, '_x_'),
|
||||
coalesce(device, '255.255.255.255'),
|
||||
coalesce(port, '_x_')
|
||||
) WHERE status = 'queued';
|
||||
|
||||
--
|
||||
-- Table: device.
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user