Bug 1127534 - unique key uc_user_id is missed defined in the model code
Summary: unique key uc_user_id is missed defined in the model code
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Community
Component: scheduler
Version: 0.17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified vote
Target Milestone: 19.0
Assignee: beaker-dev-list
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-07 04:28 UTC by matt jia
Modified: 2018-02-06 00:41 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-11-13 03:18:01 UTC


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.