kopia lustrzana https://github.com/bugout-dev/moonstream
				
				
				
			Add more efficient index.
							rodzic
							
								
									337aef6526
								
							
						
					
					
						commit
						c2fd5b25a7
					
				|  | @ -1,8 +1,8 @@ | |||
| """Add score index | ||||
| 
 | ||||
| Revision ID: f2df6f288fe7 | ||||
| Revision ID: 784c8ec69ca7 | ||||
| Revises: a9060d0527e3 | ||||
| Create Date: 2024-06-12 16:05:12.778202 | ||||
| Create Date: 2024-06-12 18:34:40.978811 | ||||
| 
 | ||||
| """ | ||||
| 
 | ||||
|  | @ -11,18 +11,18 @@ import sqlalchemy as sa | |||
| 
 | ||||
| 
 | ||||
| # revision identifiers, used by Alembic. | ||||
| revision = "f2df6f288fe7" | ||||
| revision = "784c8ec69ca7" | ||||
| down_revision = "a9060d0527e3" | ||||
| branch_labels = None | ||||
| depends_on = None | ||||
| 
 | ||||
| 
 | ||||
| def upgrade(): | ||||
|     # ### commands auto generated by Alembic - please adjust! ###\ | ||||
|     # ### commands auto generated by Alembic - please adjust! ### | ||||
|     op.create_index( | ||||
|         op.f("ix_leaderboard_scores_score"), | ||||
|         "ix_leaderboard_scores_leaderboard_id_version_score", | ||||
|         "leaderboard_scores", | ||||
|         ["score"], | ||||
|         ["leaderboard_id", "leaderboard_version_number", "score"], | ||||
|         unique=False, | ||||
|     ) | ||||
|     # ### end Alembic commands ### | ||||
|  | @ -30,5 +30,8 @@ def upgrade(): | |||
| 
 | ||||
| def downgrade(): | ||||
|     # ### commands auto generated by Alembic - please adjust! ### | ||||
|     op.drop_index(op.f("ix_leaderboard_scores_score"), table_name="leaderboard_scores") | ||||
|     op.drop_index( | ||||
|         "ix_leaderboard_scores_leaderboard_id_version_score", | ||||
|         table_name="leaderboard_scores", | ||||
|     ) | ||||
|     # ### end Alembic commands ### | ||||
|  | @ -402,6 +402,13 @@ class LeaderboardScores(Base):  # type: ignore | |||
|             ], | ||||
|             ondelete="CASCADE", | ||||
|         ), | ||||
|         Index( | ||||
|             "ix_leaderboard_scores_leaderboard_id_version_score", | ||||
|             "leaderboard_id", | ||||
|             "leaderboard_version_number", | ||||
|             "score", | ||||
|             unique=False, | ||||
|         ), | ||||
|     ) | ||||
| 
 | ||||
|     id = Column( | ||||
|  | @ -420,7 +427,7 @@ class LeaderboardScores(Base):  # type: ignore | |||
|         nullable=False, | ||||
|     ) | ||||
|     address = Column(VARCHAR(256), nullable=False, index=True) | ||||
|     score = Column(BigInteger, nullable=False, index=True) | ||||
|     score = Column(BigInteger, nullable=False) | ||||
|     points_data = Column(JSONB, nullable=True) | ||||
|     created_at = Column( | ||||
|         DateTime(timezone=True), server_default=utcnow(), nullable=False | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Andrey
						Andrey