more migration fixes

This commit is contained in:
Mike Schwörer 2023-06-18 00:49:29 +02:00
parent a9809d90cb
commit ece7612f9d
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF

View File

@ -377,8 +377,8 @@ func migrateUser(ctx context.Context, dbnew sq.DB, dbold sq.DB, user OldUser, ap
_, err = dbnew.Exec(ctx, "INSERT INTO subscriptions (subscription_id, subscriber_user_id, channel_owner_user_id, channel_internal_name, channel_id, timestamp_created, confirmed) VALUES (:sid, :suid, :ouid, :cnam, :cid, :ts, :conf)", sq.PP{ _, err = dbnew.Exec(ctx, "INSERT INTO subscriptions (subscription_id, subscriber_user_id, channel_owner_user_id, channel_internal_name, channel_id, timestamp_created, confirmed) VALUES (:sid, :suid, :ouid, :cnam, :cid, :ts, :conf)", sq.PP{
"sid": models.NewSubscriptionID(), "sid": models.NewSubscriptionID(),
"suid": user.UserId, "suid": userid,
"ouid": user.UserId, "ouid": userid,
"cnam": intName, "cnam": intName,
"cid": channelID, "cid": channelID,
"ts": oldmessage.TimestampReal.UnixMilli(), "ts": oldmessage.TimestampReal.UnixMilli(),
@ -473,7 +473,7 @@ func migrateUser(ctx context.Context, dbnew sq.DB, dbold sq.DB, user OldUser, ap
_, err = dbnew.Exec(ctx, "INSERT INTO deliveries (delivery_id, message_id, receiver_user_id, receiver_client_id, timestamp_created, timestamp_finalized, status, fcm_message_id, next_delivery) VALUES (:did, :mid, :ruid, :rcid, :tsc, :tsf, :stat, :fcm, :next)", sq.PP{ _, err = dbnew.Exec(ctx, "INSERT INTO deliveries (delivery_id, message_id, receiver_user_id, receiver_client_id, timestamp_created, timestamp_finalized, status, fcm_message_id, next_delivery) VALUES (:did, :mid, :ruid, :rcid, :tsc, :tsf, :stat, :fcm, :next)", sq.PP{
"did": models.NewDeliveryID(), "did": models.NewDeliveryID(),
"mid": messageid, "mid": messageid,
"ruid": user.UserId, "ruid": userid,
"rcid": *clientid, "rcid": *clientid,
"tsc": oldmessage.TimestampReal.UnixMilli(), "tsc": oldmessage.TimestampReal.UnixMilli(),
"tsf": oldmessage.TimestampReal.UnixMilli(), "tsf": oldmessage.TimestampReal.UnixMilli(),
@ -500,7 +500,7 @@ func migrateUser(ctx context.Context, dbnew sq.DB, dbold sq.DB, user OldUser, ap
_, err = dbnew.Exec(ctx, "INSERT INTO deliveries (delivery_id, message_id, receiver_user_id, receiver_client_id, timestamp_created, timestamp_finalized, status, fcm_message_id, next_delivery) VALUES (:did, :mid, :ruid, :rcid, :tsc, :tsf, :stat, :fcm, :next)", sq.PP{ _, err = dbnew.Exec(ctx, "INSERT INTO deliveries (delivery_id, message_id, receiver_user_id, receiver_client_id, timestamp_created, timestamp_finalized, status, fcm_message_id, next_delivery) VALUES (:did, :mid, :ruid, :rcid, :tsc, :tsf, :stat, :fcm, :next)", sq.PP{
"did": models.NewDeliveryID(), "did": models.NewDeliveryID(),
"mid": messageid, "mid": messageid,
"ruid": user.UserId, "ruid": userid,
"rcid": *clientid, "rcid": *clientid,
"tsc": oldmessage.TimestampReal.UnixMilli(), "tsc": oldmessage.TimestampReal.UnixMilli(),
"tsf": oldmessage.TimestampReal.UnixMilli(), "tsf": oldmessage.TimestampReal.UnixMilli(),