mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
bug 12387: relaxed not null constraint for unique_name - we set it to be NULL when it gets removed
This commit is contained in:
parent
bde5e16a26
commit
d77d3f5cd0
@ -323,4 +323,9 @@ public class NetworkOfferingVO implements NetworkOffering, Identity {
|
|||||||
public int getSortKey() {
|
public int getSortKey() {
|
||||||
return sortKey;
|
return sortKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUniqueName(String uniqueName) {
|
||||||
|
this.uniqueName = uniqueName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ import com.cloud.utils.db.GenericSearchBuilder;
|
|||||||
import com.cloud.utils.db.SearchBuilder;
|
import com.cloud.utils.db.SearchBuilder;
|
||||||
import com.cloud.utils.db.SearchCriteria;
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
import com.cloud.utils.db.SearchCriteria.Op;
|
import com.cloud.utils.db.SearchCriteria.Op;
|
||||||
|
import com.cloud.utils.db.Transaction;
|
||||||
|
|
||||||
@Local(value=NetworkOfferingDao.class) @DB(txn=false)
|
@Local(value=NetworkOfferingDao.class) @DB(txn=false)
|
||||||
public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Long> implements NetworkOfferingDao {
|
public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Long> implements NetworkOfferingDao {
|
||||||
@ -122,12 +123,16 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
|
|||||||
return listBy(sc, null);
|
return listBy(sc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @DB
|
||||||
public boolean remove(Long networkOfferingId){
|
public boolean remove(Long networkOfferingId){
|
||||||
|
Transaction txn = Transaction.currentTxn();
|
||||||
|
txn.start();
|
||||||
NetworkOfferingVO offering = findById(networkOfferingId);
|
NetworkOfferingVO offering = findById(networkOfferingId);
|
||||||
offering.setName(null);
|
offering.setUniqueName(null);
|
||||||
update(networkOfferingId, offering);
|
update(networkOfferingId, offering);
|
||||||
return super.remove(networkOfferingId);
|
boolean result = super.remove(networkOfferingId);
|
||||||
|
txn.commit();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -247,9 +247,9 @@ CREATE TABLE `cloud`.`nics` (
|
|||||||
|
|
||||||
CREATE TABLE `cloud`.`network_offerings` (
|
CREATE TABLE `cloud`.`network_offerings` (
|
||||||
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id',
|
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id',
|
||||||
`name` varchar(64) NOT NULL COMMENT 'name of the network offering',
|
`name` varchar(64) COMMENT 'name of the network offering',
|
||||||
`uuid` varchar(40),
|
`uuid` varchar(40),
|
||||||
`unique_name` varchar(64) NOT NULL UNIQUE COMMENT 'unique name of the network offering',
|
`unique_name` varchar(64) UNIQUE COMMENT 'unique name of the network offering',
|
||||||
`display_text` varchar(255) NOT NULL COMMENT 'text to display to users',
|
`display_text` varchar(255) NOT NULL COMMENT 'text to display to users',
|
||||||
`nw_rate` smallint unsigned COMMENT 'network rate throttle mbits/s',
|
`nw_rate` smallint unsigned COMMENT 'network rate throttle mbits/s',
|
||||||
`mc_rate` smallint unsigned COMMENT 'mcast rate throttle mbits/s',
|
`mc_rate` smallint unsigned COMMENT 'mcast rate throttle mbits/s',
|
||||||
|
|||||||
@ -303,3 +303,9 @@ ALTER TABLE `cloud`.`vm_template` ADD COLUMN `sort_key` int(32) NOT NULL default
|
|||||||
ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method';
|
ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method';
|
||||||
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method';
|
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method';
|
||||||
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method';
|
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE `cloud`.`network_offerings` MODIFY `name` varchar(64) COMMENT 'name of the network offering';
|
||||||
|
ALTER TABLE `cloud`.`network_offerings` MODIFY `unique_name` varchar(64) COMMENT 'unique name of the network offering';
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user