From 541fe530a758b10fd6d97fe4bb59eda3972241d8 Mon Sep 17 00:00:00 2001 From: Yipei Niu Date: Wed, 30 Nov 2016 13:51:48 +0800 Subject: [PATCH] Fix the bug of missing constraint 1. What is the problem In the resource routing table, there does not exist unique constraint on top_id and pod_id. 2. What is the solution to the problem Add constraint on the two columns. 3. What the features need to be implemented to the Tricircle No new feature is implemented. Change-Id: I13ce66a270de280ba13b0733cc1f39648e72d0eb --- tricircle/db/migrate_repo/versions/002_resource.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tricircle/db/migrate_repo/versions/002_resource.py b/tricircle/db/migrate_repo/versions/002_resource.py index fcf3b6dc..44d42d77 100644 --- a/tricircle/db/migrate_repo/versions/002_resource.py +++ b/tricircle/db/migrate_repo/versions/002_resource.py @@ -249,6 +249,10 @@ def upgrade(migrate_engine): sql.Column('resource_type', sql.String(length=64), nullable=False), sql.Column('created_at', sql.DateTime), sql.Column('updated_at', sql.DateTime), + migrate.UniqueConstraint( + 'top_id', 'pod_id', + name='cascaded_pods_resource_routing0top_id0pod_id' + ), mysql_engine='InnoDB', mysql_charset='utf8')