{"push_id":3101262990,"size":1,"distinct_size":1,"ref":"refs/heads/ps-unique-branches","head":"c9221636a962f5e7fe4066125b53d824c6121748","before":"1f0c9541e6698feea7faacad61340f49e45b130c","commits":[{"sha":"c9221636a962f5e7fe4066125b53d824c6121748","author":{"name":"Piotr Sarnacki","email":"58866330985292055bd3566d909d02a4014a80ea@gmail.com"},"message":"Make branches unique without cleaning up the table\n\nWe have a problem with the code in gatekeeper and possibly API\nintroducing duplicated branches. We want to add an index on\n`(repository_id, name)`, but we need to clean the table first and in\norder to do that we need to fix the bug, so no new duplicates are\nintroduced during index creation. Otherwise we would have to use a\nmaintenance window for index creation and stop all the apps from\nprocessing, which would be much harder operationally and add a\nconsiderable delay.\n\nIn this commit I introduce a simple way to overcome the problem. A new\ncolumn `unique_name` is added to branches. The column is set on UPDATEs\nand INSERTs to the branches table with a value of the `name` column. An\nindex is also added on `(repository_id, unique_name) WHERE unique_name\nIS NOT NULL`, which enforces an index on any new or updated branches\nwhen `unique_name` is not NULL.\n\nNote that this will work only for newly created branches as existing\nbranches don't have the `unique_name` column filled. That's fine,\nthough, because we create duplicate only when creating new branches in\nparallel","distinct":true,"url":"https://api.github.com/repos/travis-ci/travis-migrations/commits/c9221636a962f5e7fe4066125b53d824c6121748"}]}
{"actor":{"display_login":"drogus"}}