Bug 1127534

Summary: unique key uc_user_id is missed defined in the model code
Product: [Retired] Beaker Reporter: matt jia <mjia>
Component: schedulerAssignee: beaker-dev-list
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.17CC: aigao, asaha, dcallagh, rmancy
Target Milestone: 19.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-13 03:18:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description matt jia 2014-08-07 04:28:53 UTC
Description of problem:

The unique key uc_user_id on lab_controller is not defined in the model code.

How reproducible:

always

Steps to Reproduce:
1. run beaker-init against a fresh db
2. login to db and show create table lab_controller

Actual results:

| lab_controller | CREATE TABLE `lab_controller` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fqdn` varchar(255) DEFAULT NULL,
  `disabled` tinyint(1) NOT NULL,
  `removed` datetime DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`user_id`),
  UNIQUE KEY `fqdn` (`fqdn`),
  CONSTRAINT `lab_controller_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tg_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |

Expected results:

| lab_controller | CREATE TABLE `lab_controller` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fqdn` varchar(255) DEFAULT NULL,
  `disabled` tinyint(1) NOT NULL,
  `removed` datetime DEFAULT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uc_user_id` (`user_id`),
  UNIQUE KEY `fqdn` (`fqdn`),
  KEY `user_id` (`user_id`),
  CONSTRAINT `lab_controller_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tg_user` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 |

Additional info:

Other than adding the missing definition in the model code, we also need to use alembic to create a revision for those instances that have already been upgraded to beaker 0.17.

Comment 2 Dan Callaghan 2014-11-13 03:18:01 UTC
This was fixed as part of the cleanups for database migration tests.