consistent naming of database fields

This commit is contained in:
Igor Lobanov
2022-11-29 20:13:03 +01:00
parent c064170d24
commit 8209cc744c
20 changed files with 113 additions and 114 deletions

View File

@@ -91,12 +91,12 @@ async def create_shout(shout_dict, userslug):
).join(
User
).where(
ShoutReactionsFollower.shout_id == s.id
ShoutReactionsFollower.shoutId == s.id
).filter(
User.slug == userslug
).first()
if not srf:
srf = ShoutReactionsFollower.create(shout_id=s.id, follower_id=follower.id, auto=True)
srf = ShoutReactionsFollower.create(shoutId=s.id, followerId=follower.id, auto=True)
session.add(srf)
session.commit()
@@ -226,15 +226,15 @@ async def add_topics_follower(entry, storage, userslug):
tf = session.query(
TopicFollower
).where(
TopicFollower.follower_id == follower.id
TopicFollower.followerId == follower.id
).filter(
TopicFollower.topic_id == topic.id
TopicFollower.topicId == topic.id
).first()
if not tf:
tf = TopicFollower.create(
topic_id=topic.id,
follower_id=follower.id,
topicId=topic.id,
followerId=follower.id,
auto=True
)
session.add(tf)
@@ -325,7 +325,7 @@ async def topics_aftermath(entry, storage):
.first()
)
if shout_topic_old:
shout_topic_old.update({"topic_id": new_topic.id})
shout_topic_old.update({"topicId": new_topic.id})
else:
shout_topic_new = (
session.query(ShoutTopic)
@@ -338,7 +338,7 @@ async def topics_aftermath(entry, storage):
if not shout_topic_new:
try:
ShoutTopic.create(
**{"shout_id": shout.id, "topic_id": new_topic.id}
**{"shoutId": shout.id, "topicId": new_topic.id}
)
except Exception:
print("[migration] shout topic error: " + newslug)
@@ -373,14 +373,14 @@ async def content_ratings_to_reactions(entry, slug):
if content_rating["value"] > 0
else ReactionKind.DISLIKE,
"createdBy": reactedBy.id,
"shout_id": shout.id,
"shoutId": shout.id,
}
cts = content_rating.get("createdAt")
if cts:
reaction_dict["createdAt"] = date_parse(cts)
reaction = (
session.query(Reaction).filter(
Reaction.shout_id == reaction_dict["shout_id"]
Reaction.shoutId == reaction_dict["shoutId"]
).filter(
Reaction.createdBy == reaction_dict["createdBy"]
).filter(