)]}'
{"keystone/tests/unit/test_sql_upgrade.py":[{"author":{"_account_id":6482,"name":"Steve Martinelli","email":"s.martinelli@gmail.com","username":"stevemar"},"change_message_id":"a820d6779b159dfd21dad477355df9b95cbe3d55","unresolved":false,"context_lines":[{"line_number":1818,"context_line":""},{"line_number":1819,"context_line":"    def test_migration_011_user_id_unique_for_nonlocal_user(self):"},{"line_number":1820,"context_line":"        table_name \u003d \u0027nonlocal_user\u0027"},{"line_number":1821,"context_line":"        constraint \u003d \u0027ixu_nonlocal_user_user_id\u0027"},{"line_number":1822,"context_line":"        self.expand(10)"},{"line_number":1823,"context_line":"        self.migrate(10)"},{"line_number":1824,"context_line":"        self.contract(10)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6eadb0_0d5af2f1","line":1821,"range":{"start_line":1821,"start_character":22,"end_line":1821,"end_character":47},"updated":"2016-12-17 04:03:02.000000000","message":"this value was taken from https://github.com/openstack/keystone/blob/master/keystone/common/sql/contract_repo/versions/011_contract_user_id_unique_for_nonlocal_user.py#L23","commit_id":"f58def5c4c975a381bd545b062ced108cf490b57"},{"author":{"_account_id":17860,"name":"Samuel de Medeiros Queiroz","email":"samueldmq@gmail.com","username":"samueldmq"},"change_message_id":"414ce60af4f1ccaef5922b3729ffbe45db1bb3ad","unresolved":false,"context_lines":[{"line_number":1825,"context_line":"        if self.engine.name \u003d\u003d \u0027mysql\u0027:"},{"line_number":1826,"context_line":"            self.assertFalse(self.does_index_exist(table_name, constraint))"},{"line_number":1827,"context_line":"        else:"},{"line_number":1828,"context_line":"            self.assertFalse(self.does_constraint_exist(table_name, constraint))"},{"line_number":1829,"context_line":"        self.expand(11)"},{"line_number":1830,"context_line":"        self.migrate(11)"},{"line_number":1831,"context_line":"        self.contract(11)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6eadb0_393fecb4","line":1828,"updated":"2016-12-17 13:52:14.000000000","message":"the advantage of the newer is that we don\u0027t need to make different assertions depending on the engine.\n\nhowever it only works for unique constraints.\n\nwe could also keep the does_unique_constraint_exist method and do this if/else logic in there, re-using the existing methods. that way we keep the code cleaner here.","commit_id":"f450d638c44dbd9dd45a7c09ded7d2009f30da07"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"ee88c8fc17959796270601dbb621635422d001b6","unresolved":false,"context_lines":[{"line_number":314,"context_line":"        return index_name in [idx.name for idx in table.indexes]"},{"line_number":315,"context_line":""},{"line_number":316,"context_line":"    def does_unique_constraint_exist(self, table_name, column_name):"},{"line_number":317,"context_line":"        inspector \u003d reflection.Inspector.from_engine(self.engine)"},{"line_number":318,"context_line":"        constraints \u003d inspector.get_unique_constraints(table_name)"},{"line_number":319,"context_line":"        for c in constraints:"},{"line_number":320,"context_line":"            if (len(c[\u0027column_names\u0027]) \u003d\u003d 1 and"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6eadb0_a50ba12a","side":"PARENT","line":317,"updated":"2016-12-19 16:33:27.000000000","message":"more modern:\n\n    from sqlalchemy import inspect\n    inspector \u003d inspect(self.engine)","commit_id":"eac57b81ed8239f9bc8f7a50b599a6dc58060f86"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"ee88c8fc17959796270601dbb621635422d001b6","unresolved":false,"context_lines":[{"line_number":306,"context_line":"        return False"},{"line_number":307,"context_line":""},{"line_number":308,"context_line":"    def does_constraint_exist(self, table_name, constraint_name):"},{"line_number":309,"context_line":"        table \u003d sqlalchemy.Table(table_name, self.metadata, autoload\u003dTrue)"},{"line_number":310,"context_line":"        return constraint_name in [con.name for con in table.constraints]"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def does_index_exist(self, table_name, index_name):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6eadb0_e5575924","line":309,"updated":"2016-12-19 16:33:27.000000000","message":"this would be a lot more direct if it uses the inspector, and for MySQL you should get the unique constraint (which is the same thing as the unique index for MySQL).","commit_id":"a7cd4cb4d85723ff76b66a40e3e71d319ad578c3"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"ee88c8fc17959796270601dbb621635422d001b6","unresolved":false,"context_lines":[{"line_number":310,"context_line":"        return constraint_name in [con.name for con in table.constraints]"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def does_index_exist(self, table_name, index_name):"},{"line_number":313,"context_line":"        table \u003d sqlalchemy.Table(table_name, self.metadata, autoload\u003dTrue)"},{"line_number":314,"context_line":"        return index_name in [idx.name for idx in table.indexes]"},{"line_number":315,"context_line":""},{"line_number":316,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6eadb0_45356df5","line":313,"updated":"2016-12-19 16:33:27.000000000","message":"same here","commit_id":"a7cd4cb4d85723ff76b66a40e3e71d319ad578c3"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"ee88c8fc17959796270601dbb621635422d001b6","unresolved":false,"context_lines":[{"line_number":1830,"context_line":"        self.migrate(11)"},{"line_number":1831,"context_line":"        self.contract(11)"},{"line_number":1832,"context_line":"        if self.engine.name \u003d\u003d \u0027mysql\u0027:"},{"line_number":1833,"context_line":"            self.assertTrue(self.does_index_exist(table, constraint))"},{"line_number":1834,"context_line":"        else:"},{"line_number":1835,"context_line":"            self.assertTrue(self.does_constraint_exist(table, constraint))"},{"line_number":1836,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6eadb0_e5a91926","line":1833,"updated":"2016-12-19 16:33:27.000000000","message":"SQLAlchemy should report this for MySQL under inspector.get_unique_constraints as well as get_indexes().   In the autoloaded Table, it is likely de-duping these, which suggests changing the above methods to use inspector instead of autoload\u003dTrue would give you more accurate information.","commit_id":"a7cd4cb4d85723ff76b66a40e3e71d319ad578c3"}]}
