fix: resolve null VoteTS columns via migration

Somehow, many aur.al records of PackageVotes do not have a valid VoteTS
value. This migration fixes that issue by setting all null VoteTS
columns to the epoch timestamp.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-02-18 13:02:28 -08:00
parent 1d86b3e210
commit 8387f325f6
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 53 additions and 13 deletions

View file

@ -269,7 +269,7 @@ PackageVotes = Table(
'PackageVotes', metadata,
Column('UsersID', ForeignKey('Users.ID', ondelete='CASCADE'), nullable=False),
Column('PackageBaseID', ForeignKey('PackageBases.ID', ondelete='CASCADE'), nullable=False),
Column('VoteTS', BIGINT(unsigned=True)),
Column('VoteTS', BIGINT(unsigned=True), nullable=False),
Index('VoteUsersIDPackageID', 'UsersID', 'PackageBaseID', unique=True),
Index('VotesPackageBaseID', 'PackageBaseID'),
Index('VotesUsersID', 'UsersID'),