Add the migration for the unique index which helps prevent tag deadlocks.
This commit is contained in:
		
							parent
							
								
									201943ed1c
								
							
						
					
					
						commit
						3d44416016
					
				
					 2 changed files with 30 additions and 4 deletions
				
			
		|  | @ -19,7 +19,7 @@ up_mysql() { | |||
| 
 | ||||
| down_mysql() { | ||||
|   docker kill mysql | ||||
|   docker rm mysql | ||||
|   docker rm -v mysql | ||||
| } | ||||
| 
 | ||||
| up_mariadb() { | ||||
|  | @ -36,7 +36,7 @@ up_mariadb() { | |||
| 
 | ||||
| down_mariadb() { | ||||
|   docker kill mariadb | ||||
|   docker rm mariadb | ||||
|   docker rm -v mariadb | ||||
| } | ||||
| 
 | ||||
| up_percona() { | ||||
|  | @ -53,7 +53,7 @@ up_percona() { | |||
| 
 | ||||
| down_percona() { | ||||
|   docker kill percona | ||||
|   docker rm percona | ||||
|   docker rm -v percona | ||||
| } | ||||
| 
 | ||||
| up_postgres() { | ||||
|  | @ -70,7 +70,7 @@ up_postgres() { | |||
| 
 | ||||
| down_postgres() { | ||||
|   docker kill postgres | ||||
|   docker rm postgres | ||||
|   docker rm -v postgres | ||||
| } | ||||
| 
 | ||||
| gen_migrate() { | ||||
|  |  | |||
|  | @ -0,0 +1,26 @@ | |||
| """Add a unique index to prevent deadlocks with tags. | ||||
| 
 | ||||
| Revision ID: 2b4dc0818a5e | ||||
| Revises: 2b2529fd23ff | ||||
| Create Date: 2015-03-20 23:37:10.558179 | ||||
| 
 | ||||
| """ | ||||
| 
 | ||||
| # revision identifiers, used by Alembic. | ||||
| revision = '2b4dc0818a5e' | ||||
| down_revision = '2b2529fd23ff' | ||||
| 
 | ||||
| from alembic import op | ||||
| import sqlalchemy as sa | ||||
| 
 | ||||
| 
 | ||||
| def upgrade(tables): | ||||
|     ### commands auto generated by Alembic - please adjust! ### | ||||
|     op.create_index('repositorytag_repository_id_name_lifetime_end_ts', 'repositorytag', ['repository_id', 'name', 'lifetime_end_ts'], unique=True) | ||||
|     ### end Alembic commands ### | ||||
| 
 | ||||
| 
 | ||||
| def downgrade(tables): | ||||
|     ### commands auto generated by Alembic - please adjust! ### | ||||
|     op.drop_index('repositorytag_repository_id_name_lifetime_end_ts', table_name='repositorytag') | ||||
|     ### end Alembic commands ### | ||||
		Reference in a new issue