)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"unresolved":false,"context_lines":[{"line_number":9,"context_line":"The port security migration previously created the correct table structure but"},{"line_number":10,"context_line":"it did not migrate the old data into this table. This patch adds code that"},{"line_number":11,"context_line":"copies the id fields from networks and ports into portsecuritybindings"},{"line_number":12,"context_line":"and networksecuritybinds tables."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"One thing to note is that in grizzly when a port is created on a network that"},{"line_number":15,"context_line":"has port_security_enabled\u003dTrue the port will also be created with"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"AAAAN3%2F%2F01c%3D","line":12,"updated":"2013-03-11 10:23:20.000000000","message":"\u0027networksecuritybindings\u0027","commit_id":"a9a3ba658c1ccb352500f4a1600820cccb695910"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"unresolved":false,"context_lines":[{"line_number":17,"context_line":"created with the mac/ip security address pairs we have to set existing ports"},{"line_number":18,"context_line":"and networks port_security_enabled value to be False. One could easily"},{"line_number":19,"context_line":"write a script to do this after applying this migration to change the values"},{"line_number":20,"context_line":"to port_security_enabled\u003dTrue."},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"Fixes bug 1153366"},{"line_number":23,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"AAAAN3%2F%2F01E%3D","line":20,"updated":"2013-03-11 10:23:20.000000000","message":"some punctuation might be helpful here :)","commit_id":"a9a3ba658c1ccb352500f4a1600820cccb695910"}],"quantum/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py":[{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"3bdf7bba29bef80ae81b890a139951045080ddca","unresolved":false,"context_lines":[{"line_number":74,"context_line":"    engine \u003d op.get_bind().engine"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    results \u003d engine.execute(\"SELECT id FROM networks\")"},{"line_number":77,"context_line":"    networksecuritybindings_data \u003d map(map_values_networksecuritybindings,"},{"line_number":78,"context_line":"                                       results.fetchall())"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    if networksecuritybindings_data:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAN3%2F%2F1Ks%3D","line":77,"updated":"2013-03-11 01:59:03.000000000","message":"This will break offline migrations because the data is being read into python and emitted back out as a bulk SQL statement.  Since there is no data transformation, we should be able to use SQLAlchemy in a way that will construct a valid offline migration.  It might be easiest to use plain SQL via an execute call.  Think that would do?","commit_id":"a9a3ba658c1ccb352500f4a1600820cccb695910"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"3bdf7bba29bef80ae81b890a139951045080ddca","unresolved":false,"context_lines":[{"line_number":74,"context_line":"    engine \u003d op.get_bind().engine"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    results \u003d engine.execute(\"SELECT id FROM networks\")"},{"line_number":77,"context_line":"    networksecuritybindings_data \u003d map(map_values_networksecuritybindings,"},{"line_number":78,"context_line":"                                       results.fetchall())"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    if networksecuritybindings_data:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAN3%2F%2FzxI%3D","line":77,"in_reply_to":"AAAAN3%2F%2F01o%3D","updated":"2013-03-11 20:38:40.000000000","message":"+1  Salvatore, you were reading my mind.","commit_id":"a9a3ba658c1ccb352500f4a1600820cccb695910"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"unresolved":false,"context_lines":[{"line_number":74,"context_line":"    engine \u003d op.get_bind().engine"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    results \u003d engine.execute(\"SELECT id FROM networks\")"},{"line_number":77,"context_line":"    networksecuritybindings_data \u003d map(map_values_networksecuritybindings,"},{"line_number":78,"context_line":"                                       results.fetchall())"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    if networksecuritybindings_data:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAN3%2F%2F01o%3D","line":77,"in_reply_to":"AAAAN3%2F%2F1Ks%3D","updated":"2013-03-11 10:23:20.000000000","message":"I don\u0027t know if this is what mark meant, but I would try a statement like the following:\n\ninsert into networksecuritybindings select id as network_id, False as port_security_enabled from networks;\n\nThe aliases from tables are probably not strictly necessary (at least I don\u0027t think they have to match the column names in the dest table)","commit_id":"a9a3ba658c1ccb352500f4a1600820cccb695910"},{"author":{"_account_id":447,"name":"dan wendlandt","email":"dan@nicira.com","username":"danwent"},"unresolved":false,"context_lines":[{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    if networksecuritybindings_data:"},{"line_number":81,"context_line":"        # Create an ad-hoc table to use for insert statement"},{"line_number":82,"context_line":"        networksecuritybindings_table \u003d sql.table("},{"line_number":83,"context_line":"            \u0027networksecuritybindings\u0027,"},{"line_number":84,"context_line":"            sql.column(\u0027network_id\u0027, sa.String(length\u003d36)),"},{"line_number":85,"context_line":"            sql.column(\u0027port_security_enabled\u0027, sa.Boolean()))"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAN3%2F%2F0%2FA%3D","line":82,"updated":"2013-03-11 07:55:30.000000000","message":"should table creation depend on the existence of network, or should the table always be created as part of the migration?\n\nsame question below.","commit_id":"a9a3ba658c1ccb352500f4a1600820cccb695910"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"unresolved":false,"context_lines":[{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    if networksecuritybindings_data:"},{"line_number":81,"context_line":"        # Create an ad-hoc table to use for insert statement"},{"line_number":82,"context_line":"        networksecuritybindings_table \u003d sql.table("},{"line_number":83,"context_line":"            \u0027networksecuritybindings\u0027,"},{"line_number":84,"context_line":"            sql.column(\u0027network_id\u0027, sa.String(length\u003d36)),"},{"line_number":85,"context_line":"            sql.column(\u0027port_security_enabled\u0027, sa.Boolean()))"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAN3%2F%2F03A%3D","line":82,"in_reply_to":"AAAAN3%2F%2F0%2FA%3D","updated":"2013-03-11 10:23:20.000000000","message":"I think this statement returns the DDL object created earlier on in the script rather than creating a table.","commit_id":"a9a3ba658c1ccb352500f4a1600820cccb695910"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"unresolved":false,"context_lines":[{"line_number":69,"context_line":"    engine.execute(\"INSERT INTO networksecuritybindings SELECT id as \""},{"line_number":70,"context_line":"                   \"network_id, False as port_security_enabled from networks\")"},{"line_number":71,"context_line":"    engine.execute(\"INSERT INTO portsecuritybindings SELECT id as port_id, \""},{"line_number":72,"context_line":"                   \"False as port_security_enabled from ports\")"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"def downgrade(active_plugin\u003dNone, options\u003dNone):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAN3%2F%2Fxq8%3D","line":72,"updated":"2013-03-12 21:35:52.000000000","message":"I might be wrong, but there\u0027s a chance this might still cause the offline migration issue. need to check.\n\nAnyway, op.execute could be used in place of op.get_bind().engine.execute. What do you reckon?","commit_id":"378f19c438f9471fd3e5b4e9965e1f0adc20254d"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"70761d00c5e3f26211e9ce0836a7a0074cee4cf5","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    engine.execute(\"INSERT INTO networksecuritybindings SELECT id as \""},{"line_number":70,"context_line":"                   \"network_id, False as port_security_enabled from networks\")"},{"line_number":71,"context_line":"    engine.execute(\"INSERT INTO portsecuritybindings SELECT id as port_id, \""},{"line_number":72,"context_line":"                   \"False as port_security_enabled from ports\")"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"def downgrade(active_plugin\u003dNone, options\u003dNone):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAN3%2F%2FxlQ%3D","line":72,"in_reply_to":"AAAAN3%2F%2Fxq8%3D","updated":"2013-03-12 22:30:59.000000000","message":"Yup that works. I will test.","commit_id":"378f19c438f9471fd3e5b4e9965e1f0adc20254d"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"unresolved":false,"context_lines":[{"line_number":69,"context_line":"    engine.execute(\"INSERT INTO networksecuritybindings SELECT id as \""},{"line_number":70,"context_line":"                   \"network_id, False as port_security_enabled from networks\")"},{"line_number":71,"context_line":"    engine.execute(\"INSERT INTO portsecuritybindings SELECT id as port_id, \""},{"line_number":72,"context_line":"                   \"False as port_security_enabled from ports\")"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"def downgrade(active_plugin\u003dNone, options\u003dNone):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAN3%2F%2FxlU%3D","line":72,"in_reply_to":"AAAAN3%2F%2Fxq8%3D","updated":"2013-03-12 22:31:41.000000000","message":"op.execute() is what you want to use here.  You can pass it an SQL statement to run in the current context.","commit_id":"378f19c438f9471fd3e5b4e9965e1f0adc20254d"}]}
