-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration PostgreSQL to MariaDB: Shortening Columns #1166
Comments
For postgresql.pm everything is fine. All columns declared as VARCHAR in otobo-schema.xml are either mapped into the appropriate VARCHAR(n) type or mapped into VARCHAR. And VARCHAR has no size restriction in PostgreSQL. So, I propose to:
The latter bullet point is more pragmatic than correct. |
Moved the adaption of |
about which columns are shortened.
Adapted the check for when columns are shortened. The warnings in the error log are gone now. The messages looked sane. Did a testmigration from OTRS (Pg) to OTBOO (MySQL). Some sanity checks on the migrated database looked find. |
Let's close this issue, as the test last week looked fine. |
Another issue. When migrating from OTRS(Pg) to OTOBO(MySQL) I see many of the following message in the logfile:
This is likely nothing to worry about, as the migrated database seems to work fine. But let's investigate. The line in question is:
Dumping the infos about
$SourceColumnInfos
and$TargetColumnInfos
we get:This makes sense. The source is PostgreSQL with the datatype 'character varying' and the target is MySQL with the data type 'mediumtext'. The length on the MySQL side checks out. A mediumtext holds 16777215 bytes, about 16MB. But why is there no length on the PostgreSQL side?
The declaration of
article_data_mime.a_from
is in otobo-schema.xml:Checking the functions
_TypeTranslation()
in mysql.pm and in postgresql.pm we get confirmation that the size 1_800_000 becomes MEDIUMTEXT on MySQL and VARCHAR on PostgreSQL. It just so happens that MEDIUMTEXT (MySQL) has a size restritction while VARCHAR (Pg) has no restriction.MySQL:
PostgreSQL:
This means that we have an interesting mix. There are length differences that happen basically by accident, because of differences in data types. On the other hand, there are columns that actually should be shortened.
I tend to take the most simple approach. Treat an undefined length as infinite. Another question is how this plays with encodings. The LENGTH appears to be in bytes but the shortening is done by calling SUBSTRING(). How can this possibly work?
Originally posted by @bschmalhofer in #1149 (comment)
The text was updated successfully, but these errors were encountered: