)]}'
{"glance/db/sqlalchemy/migrate_repo/versions/038_add_metadef_tags_table.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"40eac3f001e4d0c11cd68522edf1f6b60fd518d6","unresolved":false,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        _constr_kwargs[\u0027name\u0027] \u003d \u0027ix_tags_namespace_id_name\u0027"},{"line_number":26,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027,"},{"line_number":27,"context_line":"                         meta,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6ced46_12ccf634","line":24,"updated":"2015-03-24 17:57:46.000000000","message":"Put a comment in the code explaining why there needs to be difference for DB2.","commit_id":"8728f27e73bae88d56546fd6a9f3bc601808ff6c"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"cc97928e90f7d0f0b8d5fda37247a86b3a100e0f","unresolved":false,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        _constr_kwargs[\u0027name\u0027] \u003d \u0027ix_tags_namespace_id_name\u0027"},{"line_number":26,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027,"},{"line_number":27,"context_line":"                         meta,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6ced46_fd09dedd","line":24,"in_reply_to":"1a6ced46_12ccf634","updated":"2015-03-25 01:48:39.000000000","message":"Good suggestion!","commit_id":"8728f27e73bae88d56546fd6a9f3bc601808ff6c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"61cbe0e7e538f5958bb1b6f3c1b3b7d38468a517","unresolved":false,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        _constr_kwargs[\u0027name\u0027] \u003d \u0027ix_tags_namespace_id_name\u0027"},{"line_number":26,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027,"},{"line_number":27,"context_line":"                         meta,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6ced46_3511dc05","line":24,"in_reply_to":"1a6ced46_12ccf634","updated":"2015-03-24 18:08:56.000000000","message":"I believe this is here so you can find the unique constraint in the 039 migration to drop it?  I don\u0027t think this is probably necessary, you should be able to find the constraint from the table by columns using the sqlalchemy inspector module.\n\nSomething like:\n\ninspector \u003d reflection.Inspector.from_engine(engine)\n\nconstraints \u003d inspector.get_unique_constraints(\u0027metadef_tags\u0027)\n\nThen loop over the constraints looking for the one with the matching columns that you need to drop, in this case [\u0027namespace_id\u0027, \u0027name\u0027].","commit_id":"8728f27e73bae88d56546fd6a9f3bc601808ff6c"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"cc97928e90f7d0f0b8d5fda37247a86b3a100e0f","unresolved":false,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        _constr_kwargs[\u0027name\u0027] \u003d \u0027ix_tags_namespace_id_name\u0027"},{"line_number":26,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027,"},{"line_number":27,"context_line":"                         meta,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6ced46_bd684688","line":24,"in_reply_to":"1a6ced46_3511dc05","updated":"2015-03-25 01:48:39.000000000","message":"Hi Matt, this is the common way in other versioning steps I found, there are more than several cases in glance using this approach. So I would like to keep it aligned with other steps. Make sense?","commit_id":"8728f27e73bae88d56546fd6a9f3bc601808ff6c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0f4cde6cdf3eb56048664b34580054fd56f94c42","unresolved":false,"context_lines":[{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        # Add a name for this constraint in order to get it with convenience"},{"line_number":26,"context_line":"        _constr_kwargs[\u0027name\u0027] \u003d \u0027ix_tags_namespace_id_name\u0027"},{"line_number":27,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027,"},{"line_number":28,"context_line":"                         meta,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_08ce63b4","line":25,"updated":"2015-03-25 14:10:52.000000000","message":"I\u0027d change this comment to something like:\n\n\"Explicitly name the UniqueConstraint so that we can find it by name in migration 039 to drop it. DB2 gives a random integer name to constraints if an explicit name is not provided which makes it harder to find later and remove.\"","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":12363,"name":"Oleksii Chuprykov","email":"a.chuprikoff@gmail.com","username":"ochuprykov"},"change_message_id":"5779317d19b0993fc577e7d431c017b316df2c38","unresolved":false,"context_lines":[{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        # Explicitly name the UniqueConstraint so that we can find it by name"},{"line_number":26,"context_line":"        # in migration 039 to drop it. DB2 gives a random integer name to"},{"line_number":27,"context_line":"        # constraints if an explicit name is not provided which makes it"},{"line_number":28,"context_line":"        # harder to find later and remove."}],"source_content_type":"text/x-python","patch_set":5,"id":"baa041b7_77d5ab41","line":25,"updated":"2015-04-02 13:07:54.000000000","message":"This will fail in the such situation: we have db in the state after old 38 migration(before this change), 39 migration will fail.\nI would prefer to get the name of this constraint in 39 migration, what can easily be done via sqlalchemy inspect:\n\nfrom sqlalchemy import inspect\n\ninspector \u003d inspect(engine)\n\nconstraint_name \u003d inspector.get_unique_constraints(\u0027metadef_tags\u0027)[0][\"name\"]","commit_id":"0613eaac4e32dce1467bf3da43b1ea068322a55d"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"96b0c5816d6d9ee4a92b8c610da9437db6ec2705","unresolved":false,"context_lines":[{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        # Explicitly name the UniqueConstraint so that we can find it by name"},{"line_number":26,"context_line":"        # in migration 039 to drop it. DB2 gives a random integer name to"},{"line_number":27,"context_line":"        # constraints if an explicit name is not provided which makes it"},{"line_number":28,"context_line":"        # harder to find later and remove."}],"source_content_type":"text/x-python","patch_set":5,"id":"9abe1de1_174b34b2","line":25,"in_reply_to":"baa041b7_77d5ab41","updated":"2015-04-27 08:40:45.000000000","message":"Makes sense! Thank you for pointing this out.","commit_id":"0613eaac4e32dce1467bf3da43b1ea068322a55d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d15a3ab51ccf6868a4078b24bdf790348b8abb19","unresolved":false,"context_lines":[{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        # Explicitly name the UniqueConstraint so that we can find it by name"},{"line_number":26,"context_line":"        # in migration 039 to drop it. DB2 gives a random integer name to"},{"line_number":27,"context_line":"        # constraints if an explicit name is not provided which makes it"},{"line_number":28,"context_line":"        # harder to find later and remove."}],"source_content_type":"text/x-python","patch_set":5,"id":"baa041b7_7aca20a3","line":25,"in_reply_to":"baa041b7_77d5ab41","updated":"2015-04-02 20:38:49.000000000","message":"Yeah, that\u0027s a good point.  I was sort of pushing for the same thing in an earlier patch set but apparently didn\u0027t push very hard.","commit_id":"0613eaac4e32dce1467bf3da43b1ea068322a55d"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"96b0c5816d6d9ee4a92b8c610da9437db6ec2705","unresolved":false,"context_lines":[{"line_number":22,"context_line":"def define_metadef_tags_table(meta):"},{"line_number":23,"context_line":"    _constr_kwargs \u003d {}"},{"line_number":24,"context_line":"    if meta.bind.name \u003d\u003d \u0027ibm_db_sa\u0027:"},{"line_number":25,"context_line":"        # Explicitly name the UniqueConstraint so that we can find it by name"},{"line_number":26,"context_line":"        # in migration 039 to drop it. DB2 gives a random integer name to"},{"line_number":27,"context_line":"        # constraints if an explicit name is not provided which makes it"},{"line_number":28,"context_line":"        # harder to find later and remove."}],"source_content_type":"text/x-python","patch_set":5,"id":"9abe1de1_97d504bb","line":25,"in_reply_to":"baa041b7_7aca20a3","updated":"2015-04-27 08:40:45.000000000","message":"Done.","commit_id":"0613eaac4e32dce1467bf3da43b1ea068322a55d"}],"glance/db/sqlalchemy/migrate_repo/versions/039_add_changes_to_satisfy_models_metadef.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"40eac3f001e4d0c11cd68522edf1f6b60fd518d6","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    if meta.bind.name \u003d\u003d \"ibm_db_sa\":"},{"line_number":35,"context_line":"        constraint \u003d UniqueConstraint(metadef_namespaces.c.namespace,"},{"line_number":36,"context_line":"                                      name\u003d\u0027ix_namespaces_namespace\u0027)"},{"line_number":37,"context_line":"        migrate_engine.execute(DropConstraint(constraint))"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"        constraint \u003d UniqueConstraint(metadef_objects.c.namespace_id,"},{"line_number":40,"context_line":"                                      metadef_objects.c.name,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6ced46_12f31674","line":37,"updated":"2015-03-24 17:57:46.000000000","message":"You should be able to just call constraint.drop() here and elsewhere.","commit_id":"8728f27e73bae88d56546fd6a9f3bc601808ff6c"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"cc97928e90f7d0f0b8d5fda37247a86b3a100e0f","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    if meta.bind.name \u003d\u003d \"ibm_db_sa\":"},{"line_number":35,"context_line":"        constraint \u003d UniqueConstraint(metadef_namespaces.c.namespace,"},{"line_number":36,"context_line":"                                      name\u003d\u0027ix_namespaces_namespace\u0027)"},{"line_number":37,"context_line":"        migrate_engine.execute(DropConstraint(constraint))"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"        constraint \u003d UniqueConstraint(metadef_objects.c.namespace_id,"},{"line_number":40,"context_line":"                                      metadef_objects.c.name,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6ced46_7df5eec9","line":37,"in_reply_to":"1a6ced46_12f31674","updated":"2015-03-25 01:48:39.000000000","message":"thank you for the hint, I will try.","commit_id":"8728f27e73bae88d56546fd6a9f3bc601808ff6c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0f4cde6cdf3eb56048664b34580054fd56f94c42","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    if meta.bind.name \u003d\u003d \"ibm_db_sa\":"},{"line_number":35,"context_line":"        # For db2, the following constraints need to be dropped first,"},{"line_number":36,"context_line":"        # otherwise the index like ix_metadef_ns_res_types_namespace_id"},{"line_number":37,"context_line":"        # may fail to create. These constraints will be added back at"},{"line_number":38,"context_line":"        # the end. It should not affect the origional logic for other"},{"line_number":39,"context_line":"        # database backends."},{"line_number":40,"context_line":"        constraint \u003d migrate.UniqueConstraint(metadef_namespaces.c.namespace,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_88ec13f5","line":37,"updated":"2015-03-25 14:10:52.000000000","message":"may fail or will fail?","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"34214cb1d609edcbb96d43ba318a56cd1525a8b2","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    if meta.bind.name \u003d\u003d \"ibm_db_sa\":"},{"line_number":35,"context_line":"        # For db2, the following constraints need to be dropped first,"},{"line_number":36,"context_line":"        # otherwise the index like ix_metadef_ns_res_types_namespace_id"},{"line_number":37,"context_line":"        # may fail to create. These constraints will be added back at"},{"line_number":38,"context_line":"        # the end. It should not affect the origional logic for other"},{"line_number":39,"context_line":"        # database backends."},{"line_number":40,"context_line":"        constraint \u003d migrate.UniqueConstraint(metadef_namespaces.c.namespace,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_353c53c8","line":37,"in_reply_to":"1a6ced46_88ec13f5","updated":"2015-03-25 17:50:18.000000000","message":"Should be will, it fails without the fix.","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0f4cde6cdf3eb56048664b34580054fd56f94c42","unresolved":false,"context_lines":[{"line_number":54,"context_line":"                                              \u0027_namespace_id_name\u0027"},{"line_number":55,"context_line":"                                              )"},{"line_number":56,"context_line":"        constraint.drop()"},{"line_number":57,"context_line":"    else:"},{"line_number":58,"context_line":"        Index(\u0027ix_namespaces_namespace\u0027, metadef_namespaces.c.namespace).drop()"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        Index(\u0027ix_objects_namespace_id_name\u0027, metadef_objects.c.namespace_id,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_a8df0f0c","line":57,"updated":"2015-03-25 14:10:52.000000000","message":"Why is the else here?  Do the indexes not exist for DB2?  If they do exist and we just can\u0027t drop them until the UCs are dropped, then we do that and then drop the indexes, which means we wouldn\u0027t need the else.","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"34214cb1d609edcbb96d43ba318a56cd1525a8b2","unresolved":false,"context_lines":[{"line_number":54,"context_line":"                                              \u0027_namespace_id_name\u0027"},{"line_number":55,"context_line":"                                              )"},{"line_number":56,"context_line":"        constraint.drop()"},{"line_number":57,"context_line":"    else:"},{"line_number":58,"context_line":"        Index(\u0027ix_namespaces_namespace\u0027, metadef_namespaces.c.namespace).drop()"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"        Index(\u0027ix_objects_namespace_id_name\u0027, metadef_objects.c.namespace_id,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_f57abb75","line":57,"in_reply_to":"1a6ced46_a8df0f0c","updated":"2015-03-25 17:50:18.000000000","message":"These index are not created for db2, see 035","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0f4cde6cdf3eb56048664b34580054fd56f94c42","unresolved":false,"context_lines":[{"line_number":87,"context_line":"        # may fail to create. These constraints will be added back at"},{"line_number":88,"context_line":"        # the end. It should not affect the origional logic for other"},{"line_number":89,"context_line":"        # database backends."},{"line_number":90,"context_line":"        constraint \u003d migrate.UniqueConstraint(metadef_tags.c.namespace_id,"},{"line_number":91,"context_line":"                                              metadef_tags.c.name,"},{"line_number":92,"context_line":"                                              name\u003d\u0027ix_tags_namespace_id_name\u0027)"},{"line_number":93,"context_line":"        constraint.drop()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_e89d870b","line":90,"updated":"2015-03-25 14:10:52.000000000","message":"In downgrade(), you\u0027re creating the 4 UniqueConstraints in a single block, I\u0027d do the same in upgrade() and move this UC drop call up into the block above with the other 3 drops.","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"34214cb1d609edcbb96d43ba318a56cd1525a8b2","unresolved":false,"context_lines":[{"line_number":87,"context_line":"        # may fail to create. These constraints will be added back at"},{"line_number":88,"context_line":"        # the end. It should not affect the origional logic for other"},{"line_number":89,"context_line":"        # database backends."},{"line_number":90,"context_line":"        constraint \u003d migrate.UniqueConstraint(metadef_tags.c.namespace_id,"},{"line_number":91,"context_line":"                                              metadef_tags.c.name,"},{"line_number":92,"context_line":"                                              name\u003d\u0027ix_tags_namespace_id_name\u0027)"},{"line_number":93,"context_line":"        constraint.drop()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_2b7154e0","line":90,"in_reply_to":"1a6ced46_e89d870b","updated":"2015-03-25 17:50:18.000000000","message":"Refactored.","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0f4cde6cdf3eb56048664b34580054fd56f94c42","unresolved":false,"context_lines":[{"line_number":193,"context_line":"    Index(\u0027ix_metadef_properties_namespace_id\u0027,"},{"line_number":194,"context_line":"          metadef_properties.c.namespace_id).create()"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":"    if meta.bind.name \u003d\u003d \"ibm_db_sa\":"},{"line_number":197,"context_line":"        # For db2, add these constraints back. It should not affect the"},{"line_number":198,"context_line":"        # origional logic for other database backends."},{"line_number":199,"context_line":"        constraint \u003d migrate.UniqueConstraint(metadef_namespaces.c.namespace,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_882a538e","line":196,"updated":"2015-03-25 14:10:52.000000000","message":"This blocks are completely duplicated twice, once for each drop/create.  Move this into a private helper method which takes a parameter to either drop or create the UC, then just centralize the logic there for the 4 UCs (drop the 4 at the beginning of upgrade/downgrade, create the 4 at the end of each operation).  Then we won\u0027t have all of this copy/paste code.","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"34214cb1d609edcbb96d43ba318a56cd1525a8b2","unresolved":false,"context_lines":[{"line_number":193,"context_line":"    Index(\u0027ix_metadef_properties_namespace_id\u0027,"},{"line_number":194,"context_line":"          metadef_properties.c.namespace_id).create()"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":"    if meta.bind.name \u003d\u003d \"ibm_db_sa\":"},{"line_number":197,"context_line":"        # For db2, add these constraints back. It should not affect the"},{"line_number":198,"context_line":"        # origional logic for other database backends."},{"line_number":199,"context_line":"        constraint \u003d migrate.UniqueConstraint(metadef_namespaces.c.namespace,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_6653836b","line":196,"in_reply_to":"1a6ced46_882a538e","updated":"2015-03-25 17:50:18.000000000","message":"Refactor.","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0f4cde6cdf3eb56048664b34580054fd56f94c42","unresolved":false,"context_lines":[{"line_number":281,"context_line":"                                           [metadef_namespaces.c.id])"},{"line_number":282,"context_line":"        fkc.drop()"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"        if meta.bind.name !\u003d \"ibm_db_sa\":"},{"line_number":285,"context_line":"            # This index would not be created when it is db2 backend."},{"line_number":286,"context_line":"            Index(\u0027ix_tags_namespace_id_name\u0027, metadef_tags.c.namespace_id,"},{"line_number":287,"context_line":"                  metadef_tags.c.name).create()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_28287fe1","line":284,"updated":"2015-03-25 14:10:52.000000000","message":"Why didn\u0027t test_models_sync detect this for mysql/postgresql?  This seems like a separate change, I\u0027m not sure why it\u0027s lumped in with the DB2 fix here.\n\nAnd why isn\u0027t there a check for this in glance/tests/unit/test_migrations.py?","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e9f1ef5c597a547cc95d03d1828f5f761de87d58","unresolved":false,"context_lines":[{"line_number":281,"context_line":"                                           [metadef_namespaces.c.id])"},{"line_number":282,"context_line":"        fkc.drop()"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"        if meta.bind.name !\u003d \"ibm_db_sa\":"},{"line_number":285,"context_line":"            # This index would not be created when it is db2 backend."},{"line_number":286,"context_line":"            Index(\u0027ix_tags_namespace_id_name\u0027, metadef_tags.c.namespace_id,"},{"line_number":287,"context_line":"                  metadef_tags.c.name).create()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6ced46_1ca944df","line":284,"in_reply_to":"1a6ced46_28287fe1","updated":"2015-03-25 14:14:58.000000000","message":"Looks like this is handled in 040 now:\n\nhttps://review.openstack.org/#/c/166941/5/glance/db/sqlalchemy/migrate_repo/versions/040_add_changes_to_satisfy_metadefs_tags.py\n\nIt has a different index name though and it doesn\u0027t make the change for postgresql.","commit_id":"d05417f9525df96d31c2b483076b8e7c04ef277e"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"e4d027a97f952a6f34bfa9b2bfcbbf47757f9139","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def _change_db2_unique_constraint(operation_type, constraint_name, *columns):"},{"line_number":21,"context_line":"    constraint \u003d migrate.UniqueConstraint(*columns, name\u003dconstraint_name)"},{"line_number":22,"context_line":"    if operation_type \u003d\u003d \u0027drop\u0027:"},{"line_number":23,"context_line":"        constraint.drop()"},{"line_number":24,"context_line":"    elif operation_type \u003d\u003d \u0027create\u0027:"},{"line_number":25,"context_line":"        constraint.create()"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6ced46_e1891d76","line":22,"updated":"2015-03-25 16:29:03.000000000","message":"Why not\n\n    operation \u003d getattr(constraint, operation_type, None):\n    if operation is not None:\n        operation()\n\nOr even\n\n    operation \u003d getattr(constraint, operation_type, lambda: None)\n    operation()","commit_id":"32677bf366fad1d7cba8a827795d2ae49b588db4"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"c27d385e7c16e93bae14248cff679b5f64143c26","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def _change_db2_unique_constraint(operation_type, constraint_name, *columns):"},{"line_number":21,"context_line":"    constraint \u003d migrate.UniqueConstraint(*columns, name\u003dconstraint_name)"},{"line_number":22,"context_line":"    if operation_type \u003d\u003d \u0027drop\u0027:"},{"line_number":23,"context_line":"        constraint.drop()"},{"line_number":24,"context_line":"    elif operation_type \u003d\u003d \u0027create\u0027:"},{"line_number":25,"context_line":"        constraint.create()"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6ced46_aec2ad31","line":22,"in_reply_to":"1a6ced46_e1891d76","updated":"2015-03-25 17:55:29.000000000","message":"Good idea!","commit_id":"32677bf366fad1d7cba8a827795d2ae49b588db4"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5ae696cbb4f81a4defd2f9d37ecd205d8a781cf4","unresolved":false,"context_lines":[{"line_number":207,"context_line":"                                   autoload\u003dTrue)"},{"line_number":208,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027, meta, autoload\u003dTrue)"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"    constraints \u003d [(\u0027ix_namespaces_namespace\u0027,"},{"line_number":211,"context_line":"                    [metadef_namespaces.c.namespace]),"},{"line_number":212,"context_line":"                   (\u0027ix_objects_namespace_id_name\u0027,"},{"line_number":213,"context_line":"                    [metadef_objects.c.namespace_id,"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6ced46_d9eb3111","line":210,"updated":"2015-03-25 18:02:47.000000000","message":"Yuck, this is only used in the DB2 block, move this into the private helper method _change_db2_unique_constraint because it\u0027s completely duplicated still between upgrade and downgrade.","commit_id":"32677bf366fad1d7cba8a827795d2ae49b588db4"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"273cdcd359940e865fc0072a77f96fef1eb25d22","unresolved":false,"context_lines":[{"line_number":21,"context_line":"    constraint \u003d migrate.UniqueConstraint(*columns, name\u003dconstraint_name)"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"    operation \u003d getattr(constraint, operation_type, None)"},{"line_number":24,"context_line":"    if operation is not None:"},{"line_number":25,"context_line":"        operation()"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_34ba8c6e","line":24,"updated":"2015-03-25 18:41:09.000000000","message":"This shouldn\u0027t be necessary.  If for whatever reason None comes back, then the migration is still going to fail, but in a weird way because we expect this to work.  So I\u0027d remove the conditional check here.\n\nI\u0027d drop the None default arg too so that AttributeError is raised if calling with an invalid operation_type.","commit_id":"2af58f7992632b579afc3c88e48691739d812a1d"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"60534d524463b587b2c78163b8a60eb0d4fe9558","unresolved":false,"context_lines":[{"line_number":21,"context_line":"    constraint \u003d migrate.UniqueConstraint(*columns, name\u003dconstraint_name)"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"    operation \u003d getattr(constraint, operation_type, None)"},{"line_number":24,"context_line":"    if operation is not None:"},{"line_number":25,"context_line":"        operation()"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_9fb7d939","line":24,"in_reply_to":"1a6ced46_34ba8c6e","updated":"2015-03-25 18:49:53.000000000","message":"Make sense.","commit_id":"2af58f7992632b579afc3c88e48691739d812a1d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"de7041442511294fec820e1963718e935fcc6f75","unresolved":false,"context_lines":[{"line_number":39,"context_line":"                                   autoload\u003dTrue)"},{"line_number":40,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027, meta, autoload\u003dTrue)"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    constraints \u003d [(\u0027ix_namespaces_namespace\u0027,"},{"line_number":43,"context_line":"                    [metadef_namespaces.c.namespace]),"},{"line_number":44,"context_line":"                   (\u0027ix_objects_namespace_id_name\u0027,"},{"line_number":45,"context_line":"                    [metadef_objects.c.namespace_id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_79c31d89","line":42,"updated":"2015-03-25 18:03:27.000000000","message":"See comment in patch set 3, the constraints list is duplicated between upgrade and downgrade and is only used in the DB2 case, so move it into _change_db2_unique_constraint.","commit_id":"2af58f7992632b579afc3c88e48691739d812a1d"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"60534d524463b587b2c78163b8a60eb0d4fe9558","unresolved":false,"context_lines":[{"line_number":39,"context_line":"                                   autoload\u003dTrue)"},{"line_number":40,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027, meta, autoload\u003dTrue)"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    constraints \u003d [(\u0027ix_namespaces_namespace\u0027,"},{"line_number":43,"context_line":"                    [metadef_namespaces.c.namespace]),"},{"line_number":44,"context_line":"                   (\u0027ix_objects_namespace_id_name\u0027,"},{"line_number":45,"context_line":"                    [metadef_objects.c.namespace_id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_1ff20906","line":42,"in_reply_to":"1a6ced46_34a36c50","updated":"2015-03-25 18:49:53.000000000","message":"yep, ok.","commit_id":"2af58f7992632b579afc3c88e48691739d812a1d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"273cdcd359940e865fc0072a77f96fef1eb25d22","unresolved":false,"context_lines":[{"line_number":39,"context_line":"                                   autoload\u003dTrue)"},{"line_number":40,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027, meta, autoload\u003dTrue)"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    constraints \u003d [(\u0027ix_namespaces_namespace\u0027,"},{"line_number":43,"context_line":"                    [metadef_namespaces.c.namespace]),"},{"line_number":44,"context_line":"                   (\u0027ix_objects_namespace_id_name\u0027,"},{"line_number":45,"context_line":"                    [metadef_objects.c.namespace_id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_34a36c50","line":42,"in_reply_to":"1a6ced46_74408434","updated":"2015-03-25 18:41:09.000000000","message":"It\u0027s 4 tables from what I see, so 4 lines of duplicate code in that method as opposed to 20 duplicated lines between upgrade/downgrade here.  But I guess you are going to call _change_db2_unique_constraint twice in each method, so it\u0027s some unnecessary creating of table objects.\n\nSo I guess since both are bad, might as well just leave this.","commit_id":"2af58f7992632b579afc3c88e48691739d812a1d"},{"author":{"_account_id":12196,"name":"Jun Hong Li","email":"junhongl@cn.ibm.com","username":"Junhongl"},"change_message_id":"887412ee3c70cfc371af85ab28d5a970376adb05","unresolved":false,"context_lines":[{"line_number":39,"context_line":"                                   autoload\u003dTrue)"},{"line_number":40,"context_line":"    metadef_tags \u003d Table(\u0027metadef_tags\u0027, meta, autoload\u003dTrue)"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    constraints \u003d [(\u0027ix_namespaces_namespace\u0027,"},{"line_number":43,"context_line":"                    [metadef_namespaces.c.namespace]),"},{"line_number":44,"context_line":"                   (\u0027ix_objects_namespace_id_name\u0027,"},{"line_number":45,"context_line":"                    [metadef_objects.c.namespace_id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_74408434","line":42,"in_reply_to":"1a6ced46_79c31d89","updated":"2015-03-25 18:23:57.000000000","message":"Hi Matt,\n\nIf we would like to abstract those dup constraints into _change_db2_unique_constraint, then we have to move the table vars like metadef_namespaces as well. So I think that\u0027s kind of overkill, what\u0027s your opinion?","commit_id":"2af58f7992632b579afc3c88e48691739d812a1d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"2659c4267a32eb2bff55eaf05bea423070b99e13","unresolved":false,"context_lines":[{"line_number":46,"context_line":"                   (\u0027ix_metadef_properties_namespace_id_name\u0027,"},{"line_number":47,"context_line":"                    [metadef_properties.c.namespace_id,"},{"line_number":48,"context_line":"                     metadef_properties.c.name])]"},{"line_number":49,"context_line":"    metadef_tags_constraints \u003d inspector.get_unique_constraints(\u0027metadef_tags\u0027)"},{"line_number":50,"context_line":"    for constraint in metadef_tags_constraints:"},{"line_number":51,"context_line":"        if set(constraint[\u0027column_names\u0027]) \u003d\u003d set([\u0027namespace_id\u0027, \u0027name\u0027]):"},{"line_number":52,"context_line":"            constraints.append((constraint[\u0027name\u0027],"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aca2d91_708584ab","line":49,"updated":"2015-05-07 16:21:23.000000000","message":"nit: you could pull this into a private helper so it\u0027s not copy/paste but that\u0027s only if downgrade is still used.","commit_id":"66bc15dcce045624c082c145ba873acd64b06158"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"2659c4267a32eb2bff55eaf05bea423070b99e13","unresolved":false,"context_lines":[{"line_number":196,"context_line":"            _change_db2_unique_constraint(\u0027create\u0027, constraint_name, *cols)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"def downgrade(migrate_engine):"},{"line_number":200,"context_line":"    meta \u003d sqlalchemy.MetaData()"},{"line_number":201,"context_line":"    meta.bind \u003d migrate_engine"},{"line_number":202,"context_line":"    inspector \u003d inspect(migrate_engine)"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aca2d91_70fea439","line":199,"updated":"2015-05-07 16:21:23.000000000","message":"I thought we were dropping downgrades now?","commit_id":"66bc15dcce045624c082c145ba873acd64b06158"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"fa655b403187f11856099512fb164e9a05c11455","unresolved":false,"context_lines":[{"line_number":196,"context_line":"            _change_db2_unique_constraint(\u0027create\u0027, constraint_name, *cols)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"def downgrade(migrate_engine):"},{"line_number":200,"context_line":"    meta \u003d sqlalchemy.MetaData()"},{"line_number":201,"context_line":"    meta.bind \u003d migrate_engine"},{"line_number":202,"context_line":"    inspector \u003d inspect(migrate_engine)"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aca2d91_d0445875","line":199,"in_reply_to":"1aca2d91_70fea439","updated":"2015-05-07 16:23:17.000000000","message":"Looks like that\u0027s only for new migrations.  In nova we just removed downgrades from all scripts.","commit_id":"66bc15dcce045624c082c145ba873acd64b06158"}]}
