)]}'
{"keystone/common/sql/data_migration_repo/versions/030_migrate_non_enum_assignment_type.py":[{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"dcefd6fc24f138f662772fbeabbe8fbcde8aa9a6","unresolved":false,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":"    for assignment in assignments:"},{"line_number":25,"context_line":"        values \u003d {\u0027assignment_type\u0027: assignment.type}"},{"line_number":26,"context_line":"        update \u003d assignment_table.update().where("},{"line_number":27,"context_line":"            assignment_table.c.type \u003d\u003d assignment.type and"},{"line_number":28,"context_line":"            assignment_table.c.actor_id \u003d\u003d assignment.actor_id and"},{"line_number":29,"context_line":"            assignment_table.c.target_id \u003d\u003d assignment.target_id and"},{"line_number":30,"context_line":"            assignment_table.c.role_id \u003d\u003d assignment.role_id and"},{"line_number":31,"context_line":"            assignment_table.c.inherited \u003d\u003d assignment.inherited"},{"line_number":32,"context_line":"        ).values(values)"},{"line_number":33,"context_line":"        session.execute(update)"},{"line_number":34,"context_line":"        session.commit()"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_d8f93e4e","line":31,"range":{"start_line":26,"start_character":8,"end_line":31,"end_character":64},"updated":"2017-09-07 22:33:42.000000000","message":"This can probably be simplified. We don\u0027t care about actor_id, target_id, role_id, or inherited. You can simply do a blanket update.\n\nWe might be able to do this (have to look at how the backends work) but you might be able to do this in raw sql as a simple update statement instead of an iteration where we need to inspect the values.","commit_id":"3bf5eaa81794b3b0e2077a84cec8a083e4c7edf9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"1c0bb98fbff0e768a36e140ad1c9e9d8183cdc34","unresolved":false,"context_lines":[{"line_number":28,"context_line":"            assignment_table.c.actor_id \u003d\u003d assignment.actor_id and"},{"line_number":29,"context_line":"            assignment_table.c.target_id \u003d\u003d assignment.target_id and"},{"line_number":30,"context_line":"            assignment_table.c.role_id \u003d\u003d assignment.role_id and"},{"line_number":31,"context_line":"            assignment_table.c.inherited \u003d\u003d assignment.inherited"},{"line_number":32,"context_line":"        ).values(values)"},{"line_number":33,"context_line":"        session.execute(update)"},{"line_number":34,"context_line":"        session.commit()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f2577a7_ad349ddf","line":31,"in_reply_to":"7f287b81_d8f93e4e","updated":"2017-09-08 13:53:14.000000000","message":"Yeah - this part tripped me up because most cases where we have to modify while iterating over a set, we have an ID of some sort as the PK. \n\n    for thing in things:\n        values \u003d {\u0027key\u0027: some_value}\n        update \u003d thing_table.update().where(\n            thing_table.c.id \u003d\u003d thing.id\n        ).values(values)\n        session.execute(update)\n        session.commit()\n    session.close()\n\nI wasn\u0027t sure how to do that here because the PK for the assignment table is literally every column.","commit_id":"3bf5eaa81794b3b0e2077a84cec8a083e4c7edf9"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"dcefd6fc24f138f662772fbeabbe8fbcde8aa9a6","unresolved":false,"context_lines":[{"line_number":22,"context_line":"    assignments \u003d list(assignment_table.select().execute())"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"    for assignment in assignments:"},{"line_number":25,"context_line":"        values \u003d {\u0027assignment_type\u0027: assignment.type}"},{"line_number":26,"context_line":"        update \u003d assignment_table.update().where("},{"line_number":27,"context_line":"            assignment_table.c.type \u003d\u003d assignment.type and"},{"line_number":28,"context_line":"            assignment_table.c.actor_id \u003d\u003d assignment.actor_id and"},{"line_number":29,"context_line":"            assignment_table.c.target_id \u003d\u003d assignment.target_id and"},{"line_number":30,"context_line":"            assignment_table.c.role_id \u003d\u003d assignment.role_id and"},{"line_number":31,"context_line":"            assignment_table.c.inherited \u003d\u003d assignment.inherited"},{"line_number":32,"context_line":"        ).values(values)"},{"line_number":33,"context_line":"        session.execute(update)"},{"line_number":34,"context_line":"        session.commit()"},{"line_number":35,"context_line":"    session.close()"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_38b722f8","line":34,"range":{"start_line":25,"start_character":2,"end_line":34,"end_character":24},"updated":"2017-09-07 22:33:42.000000000","message":"This doesn\u0027t guarantee all data is migrated, if a change is made while this is occuring, it will miss that.\n\nNot sure how we handle that.","commit_id":"3bf5eaa81794b3b0e2077a84cec8a083e4c7edf9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"1c0bb98fbff0e768a36e140ad1c9e9d8183cdc34","unresolved":false,"context_lines":[{"line_number":31,"context_line":"            assignment_table.c.inherited \u003d\u003d assignment.inherited"},{"line_number":32,"context_line":"        ).values(values)"},{"line_number":33,"context_line":"        session.execute(update)"},{"line_number":34,"context_line":"        session.commit()"},{"line_number":35,"context_line":"    session.close()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f2577a7_0da971de","line":34,"in_reply_to":"7f287b81_38b722f8","updated":"2017-09-08 13:53:14.000000000","message":"We have two options for handling that. \n\n1.) We can make keystone smart enough to check both columns and pick the right value. If `assignment_type` is None and `type` is not, port the value to `assignment_type`. We\u0027d have to maintain this code for a release. This will mean we have to keep the `type` column until Rocky opens. That is assuming every assignment is touched while Queens is deployed in order to move the assignment `type` to `assignment_type`.\n\n2.) Use a trigger to ensure the data from `type` is put into `assignment_type` if an update happens during a migration. This approach will allow us to drop the `type` column in contract of this migration.\n\nThis also only applies to rolling upgrades or live upgrades. If the data is migrated while keystone is offline, we don\u0027t have an issue.","commit_id":"3bf5eaa81794b3b0e2077a84cec8a083e4c7edf9"}],"keystone/common/sql/expand_repo/versions/030_expand_add_non_enum_assignment_type.py":[{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"dcefd6fc24f138f662772fbeabbe8fbcde8aa9a6","unresolved":false,"context_lines":[{"line_number":18,"context_line":"    meta.bind \u003d migrate_engine"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"    assignment_table \u003d sql.Table(\u0027assignment\u0027, meta, autoload\u003dTrue)"},{"line_number":21,"context_line":"    assignment_type \u003d sql.Column("},{"line_number":22,"context_line":"        \u0027assignment_type\u0027, sql.String(64), nullable\u003dTrue"},{"line_number":23,"context_line":"    )"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    assignment_table.create_column(assignment_type)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_f8e3da03","line":23,"range":{"start_line":21,"start_character":0,"end_line":23,"end_character":5},"updated":"2017-09-07 22:33:42.000000000","message":"This is going to need an Index. We need to be able to find by type iirc.","commit_id":"3bf5eaa81794b3b0e2077a84cec8a083e4c7edf9"}]}
