AuditEntry::ModificationType::UPDATE,
"subnet set");
}
+
+ // Insert another subnet.
+ cbptr_->createUpdateSubnet4(ServerSelector::ALL(), test_subnets_[2]);
+
+ // Fetch this subnet by prefix and verify it matches.
+ returned_subnet = cbptr_->getSubnet4(ServerSelector::ALL(),
+ test_subnets_[2]->toText());
+ ASSERT_TRUE(returned_subnet);
+ EXPECT_EQ(test_subnets_[2]->toElement()->str(), returned_subnet->toElement()->str());
+
+ // Update the the subnet in the database (both use the same prefix).
+ subnet2.reset(new Subnet4(IOAddress("192.0.3.0"), 24, 30, 40, 60, 8192));
+ cbptr_->createUpdateSubnet4(ServerSelector::ALL(), subnet2);
+
+ // Fetch again and verify.
+ returned_subnet = cbptr_->getSubnet4(ServerSelector::ALL(),
+ test_subnets_[2]->toText());
+ ASSERT_TRUE(returned_subnet);
+ EXPECT_EQ(subnet2->toElement()->str(), returned_subnet->toElement()->str());
}
// Test that the information about unspecified optional parameters gets
REFERENCES dhcp6_shared_network (id)
ON DELETE CASCADE ON UPDATE NO ACTION;
+-- Update dhcp4_subnet_server and dhcp6_subnet_server to allow update
+-- on the prefix too.
+
+ALTER TABLE dhcp4_subnet_server
+ DROP FOREIGN KEY fk_dhcp4_subnet_server_subnet_id;
+ALTER TABLE dhcp4_subnet_server
+ ADD CONSTRAINT fk_dhcp4_subnet_server_subnet_id FOREIGN KEY (subnet_id)
+ REFERENCES dhcp4_subnet (subnet_id)
+ ON DELETE CASCADE ON UPDATE CASCADE;
+
+ALTER TABLE dhcp6_subnet_server
+ DROP FOREIGN KEY fk_dhcp6_subnet_server_subnet_id;
+ALTER TABLE dhcp6_subnet_server
+ ADD CONSTRAINT fk_dhcp6_subnet_server_subnet_id FOREIGN KEY (subnet_id)
+ REFERENCES dhcp6_subnet (subnet_id)
+ ON DELETE CASCADE ON UPDATE CASCADE;
+
-- -----------------------------------------------------
-- Table `dhcp6_audit_revision`
-- -----------------------------------------------------
REFERENCES dhcp6_shared_network (id)
ON DELETE CASCADE ON UPDATE NO ACTION;
+-- Update dhcp4_subnet_server and dhcp6_subnet_server to allow update
+-- on the prefix too.
+
+ALTER TABLE dhcp4_subnet_server
+ DROP FOREIGN KEY fk_dhcp4_subnet_server_subnet_id;
+ALTER TABLE dhcp4_subnet_server
+ ADD CONSTRAINT fk_dhcp4_subnet_server_subnet_id FOREIGN KEY (subnet_id)
+ REFERENCES dhcp4_subnet (subnet_id)
+ ON DELETE CASCADE ON UPDATE CASCADE;
+
+ALTER TABLE dhcp6_subnet_server
+ DROP FOREIGN KEY fk_dhcp6_subnet_server_subnet_id;
+ALTER TABLE dhcp6_subnet_server
+ ADD CONSTRAINT fk_dhcp6_subnet_server_subnet_id FOREIGN KEY (subnet_id)
+ REFERENCES dhcp6_subnet (subnet_id)
+ ON DELETE CASCADE ON UPDATE CASCADE;
+
-- -----------------------------------------------------
-- Table dhcp6_audit_revision
-- -----------------------------------------------------