Schema is inconsistent (tigase.org mysql vs clean postgresql) (#70)
wojciech.kapcia@tigase.net opened 4 years ago

While working on migration I noticed that cleanly created postgresql differ from (existing on tigase.org) mysql schema, namely tig_ma_msgs table.

| Mysql | Postgres | |-|-| | owner_id | owner_id | | buddy_id | buddy_id | | ts | ts | | msg | msg | | | direction | | | type | | body | body | | | stanza_hash | | | buddy_res | | stable_id | stable_id | | stanza_id | stanza_id | | ref_stable_id | ref_stable_id | | is_ref | is_ref |

It looks that the intention was to drop those columns

Andrzej Wójcik (Tigase) commented 4 years ago

As I look on the schema for MySQL it looks like the order of the statements was changed at some point (maybe during refactoring - to modify multiple columns at once as it improoved performance of table schema modification). As a result those columns were not dropped.

Should we update this schema to make sure that they are dropped?

wojciech.kapcia@tigase.net commented 4 years ago

I'd say yes: to both be consistent and have intended state of the schema.

Andrzej Wójcik (Tigase) commented 4 years ago

I've just "recreated" schema for MySQL (on the new database) in version 2.0.0 and upgrade it to version 3.0.0 and problematic fields were removed.

I would say that we have an issue with current version of the database on tigase.org caused by any of the following:

  1. manual running of the update due to initial issues with upgrade of the database
  2. subsequent upgrades between snapshot builds did not upgrade database properly
  3. manual start of previous version of the schema script set version to "stable" so subsequent runs of schema upgrade were not executed

As for point 3. we still have following line there:

call TigSetComponentVersion('message-archiving', '3.0.0');

What we can do?

  1. Leave it as it is, as it removes columns properly while running normal upgrade process.
  2. Add additional checks to remove those columns

I suppose, that I've manually removed msg_id column as we had some constraint issues and had to fix them on this database, so it is most likely that I've forgot to drop the rest of those columns and condition to drop them is based on existence of msg_id columns.

wojciech.kapcia@tigase.net commented 4 years ago

I'm sorry I haven't made myself more clear - tigase.org database/schema is correct. Cleanly created postgres schema contains those additional fields (indicated in the table in the first message). It seems that the SP from the linked commit is not applied correctly here.

Andrzej Wójcik (Tigase) commented 4 years ago

The schema is now fixed.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Version
tigase-server-8.2.0
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/tigase-message-archiving#70
Please wait...
Page is in error, reload to recover