)]}'
{"gnocchi/indexer/alembic/versions/27d2a1d205ff_add_updating_resource_type_states.py":[{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"14205cb960256ec787aa1d7327a7390657fc86c1","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                       (\u0027active\u0027, \u0027creating\u0027, \u0027creation_error\u0027, \\"},{"line_number":68,"context_line":"                        \u0027deleting\u0027, \u0027deletion_error\u0027, \u0027updating\u0027, \\"},{"line_number":69,"context_line":"                        \u0027updating_error\u0027)\")"},{"line_number":70,"context_line":"        op.execute(\"ALTER TABLE resource_type ALTER COLUMN state TYPE \\"},{"line_number":71,"context_line":"                   resource_type_state_enum USING \\"},{"line_number":72,"context_line":"                   state::text::resource_type_state_enum\")"},{"line_number":73,"context_line":"        op.execute(\"DROP TYPE old_resource_type_state_enum\")"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    # NOTE(sileht): we can\u0027t alter type with server_default set on"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a8ec9b2_e02f3386","line":72,"range":{"start_line":70,"start_character":0,"end_line":72,"end_character":58},"updated":"2016-09-20 13:24:24.000000000","message":"just curious, what does this do? seems like it\u0027s doing what alter_column does above?","commit_id":"aa3d0ae22f9004eb6ad294f4cb255f694f32c443"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"e11d0c556e42edd37c8f9d2155637d1b8487383d","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                       (\u0027active\u0027, \u0027creating\u0027, \u0027creation_error\u0027, \\"},{"line_number":68,"context_line":"                        \u0027deleting\u0027, \u0027deletion_error\u0027, \u0027updating\u0027, \\"},{"line_number":69,"context_line":"                        \u0027updating_error\u0027)\")"},{"line_number":70,"context_line":"        op.execute(\"ALTER TABLE resource_type ALTER COLUMN state TYPE \\"},{"line_number":71,"context_line":"                   resource_type_state_enum USING \\"},{"line_number":72,"context_line":"                   state::text::resource_type_state_enum\")"},{"line_number":73,"context_line":"        op.execute(\"DROP TYPE old_resource_type_state_enum\")"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    # NOTE(sileht): we can\u0027t alter type with server_default set on"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a8ec9b2_40e8e77c","line":72,"range":{"start_line":70,"start_character":0,"end_line":72,"end_character":58},"in_reply_to":"7a8ec9b2_e02f3386","updated":"2016-09-20 13:35:36.000000000","message":"We can imagine postgres ENUM like an array, the value in table row is only the index in the enum, the col type the ENUM identifier (not the name).\n\nWhen you rename resource_type_state_enum to old_resource_type_state_enum that just change the name not the \u0027identifier\u0027 on the ENUM. So resource_type.state values (ENUM index) are still pointing to the old type.\n\nThis line switches the ENUM indentifier from the old one to the new.\nThe USING tells postgres to use the \"value\" of the \"state\" column cast in \"text\" to select the new index in the new ENUM. The cast in text on an ENUM select the real \u0027text\u0027 value of the ENUM.\n\nsqlalchemy doesn\u0027t support well this (awesome ;p) feature. When you alter the column and a ENUM type already exists with that name, it does nothing. That why all this step are needed.","commit_id":"aa3d0ae22f9004eb6ad294f4cb255f694f32c443"}]}
