Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Missing columns in batch_upload_items when upgrading older syncserver  #214

Open

Description

@new0ne

Hi there!
After upgrading my syncserver to the current version it ran into several errors:
the users table was missing the columns: keys_changed_at as well as node.
Luckily i found #208 and applied the suggested changes.
But other than that my table batch_upload_items has a different schema than its expected in head, which leads to errors like:
InternalError: (pymysql.err.InternalError) (1054, u"Unknown column 'userid' in 'where clause'")
[SQL: /* [queryName=APPLY_BATCH_INSERT] */
INSERT INTO bso
(userid, collection, id, modified, sortindex,ttl, payload, payload_size)
SELECT %(userid)s, %(collection)s, id, %(modified)s, sortindex,
COALESCE(ttl_offset + %(ttl_base)s, %(default_ttl)s),
COALESCE(payload, ''),
COALESCE(payload_size, 0)
FROM batch_upload_items
WHERE batch = %(batch)s AND userid = %(userid)s
ON DUPLICATE KEY UPDATE
modified = %(modified)s,
sortindex = COALESCE(batch_upload_items.sortindex,
bso.sortindex),
ttl = COALESCE(batch_upload_items.ttl_offset + %(ttl_base)s,
bso.ttl),
payload = COALESCE(batch_upload_items.payload,
bso.payload),
payload_size = COALESCE(batch_upload_items.payload_size,
bso.payload_size)
...
my table batch_upload_items looks like:
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| batch | bigint(20) | NO | PRI | NULL | |
| id | varchar(64) | NO | PRI | NULL | |
| sortindex | int(11) | YES | | NULL | |
| payload | mediumtext | YES | | NULL | |
| payload_size | int(11) | YES | | NULL | |
| ttl_offset | int(11) | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+

I am trying to find the point in time (in the repo) where that got changed and finding a "database migration script" if there is any.
Would be awesome if somebody knows how to fix that.

Kind regards

Activity

  1. changed the title [-]Missing columns in batch_upload_ites when upgrading older syncserver [/-] [+]Missing columns in batch_upload_items when upgrading older syncserver [/+] on May 30, 2020
  2. rfk commented on May 31, 2020

    @rfk
    Contributor

    finding a "database migration script" if there is any

    Unfortunately we haven't built one of those for this repo. In this case I think your best bet is to drop the batch_uploads and batch_upload_items items tables, restart the server and let is re-create them with correct schema. These tables are only used for temporary data so this should be a safe operation.

  3. added a commit that references this issue on Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions