<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=ManualDatabaseConversion</id>
	<title>ManualDatabaseConversion - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=ManualDatabaseConversion"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;action=history"/>
	<updated>2026-08-24T01:06:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27213&amp;oldid=prev</id>
		<title>Phanousk at 09:45, 29 October 2024</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27213&amp;oldid=prev"/>
		<updated>2024-10-29T09:45:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 05:45, 29 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l6&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; -- to fix some garbage gathered through the years of upgrading your system. If you want to first check what it will do, just ommit the &amp;lt;code&amp;gt;--resolve&amp;lt;/code&amp;gt; option.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; -- to fix some garbage gathered through the years of upgrading your system. If you want to first check what it will do, just ommit the &amp;lt;code&amp;gt;--resolve&amp;lt;/code&amp;gt; option.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-serializer --clone --page 200 --directory /var/tmp/serialized --force --size 500 &amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-serializer --clone --page 200 --directory /var/tmp/serialized --force --size 500 &amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* BEWARE: If you use [https://metacpan.org/pod/RT::Extension::MergeUsers RT::Extension::MergeUsers], you should disable it before serialization. Otherwise the import won&#039;t run correctly.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* BEWARE: If you use [https://metacpan.org/pod/RT::Extension::MergeUsers RT::Extension::MergeUsers], you should disable it before serialization. Otherwise the import &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;afterwards &lt;/ins&gt;won&#039;t run correctly.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;drop database rtdb;&amp;quot;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;drop database rtdb;&amp;quot;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) optionally run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;ALTER USER postgres PASSWORD &amp;#039;some_password&amp;#039;;&amp;quot;&amp;lt;/code&amp;gt; -- you will need this password in next step&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) optionally run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;ALTER USER postgres PASSWORD &amp;#039;some_password&amp;#039;;&amp;quot;&amp;lt;/code&amp;gt; -- you will need this password in next step&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-27212:rev-27213:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Phanousk</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27212&amp;oldid=prev</id>
		<title>Phanousk: Add some new info about MergeUsers extension.</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27212&amp;oldid=prev"/>
		<updated>2024-10-29T09:45:04Z</updated>

		<summary type="html">&lt;p&gt;Add some new info about MergeUsers extension.&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 05:45, 29 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Converting the database from MySQL (MariaDB) to PostgreSQL =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Converting the database from MySQL (MariaDB) to PostgreSQL =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is a very straightforward article for set-up environment. For some deeper details refer [[MigrateMysql2PostgresqlV4|older article]] about migrating.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is a very straightforward article for set-up environment. For some deeper details refer [[MigrateMysql2PostgresqlV4|older article]] about migrating&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. This should also work for serializing and importing the same database type, not just MariaDB to Postgres&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This HowTo assume you have set-up some current production RT instance with MySQL or MariaDB database server and want to move it to PostgreSQL which should be more robust. So here we go:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This HowTo assume you have set-up some current production RT instance with MySQL or MariaDB database server and want to move it to PostgreSQL which should be more robust. So here we go:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Backup &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;youre &lt;/del&gt;production database!&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Backup &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;your &lt;/ins&gt;production database!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; -- to fix some garbage gathered through the years of upgrading your system. If you want to first check what it will do, just ommit the &amp;lt;code&amp;gt;--resolve&amp;lt;/code&amp;gt; option.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; -- to fix some garbage gathered through the years of upgrading your system. If you want to first check what it will do, just ommit the &amp;lt;code&amp;gt;--resolve&amp;lt;/code&amp;gt; option.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-serializer --clone --page 200 --directory /var/tmp/serialized --force --size 500 &amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-serializer --clone --page 200 --directory /var/tmp/serialized --force --size 500 &amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#* BEWARE: If you use [https://metacpan.org/pod/RT::Extension::MergeUsers RT::Extension::MergeUsers], you should disable it before serialization. Otherwise the import won&#039;t run correctly.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;drop database rtdb;&amp;quot;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;drop database rtdb;&amp;quot;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) optionally run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;ALTER USER postgres PASSWORD &amp;#039;some_password&amp;#039;;&amp;quot;&amp;lt;/code&amp;gt; -- you will need this password in next step&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) optionally run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;ALTER USER postgres PASSWORD &amp;#039;some_password&amp;#039;;&amp;quot;&amp;lt;/code&amp;gt; -- you will need this password in next step&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l12&quot;&gt;Line 12:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-importer /var/tmp/serialized&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-importer /var/tmp/serialized&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;PERL5LIB=&amp;quot;/opt/rt4/lib:/opt/rt4/local/lib&amp;quot; /opt/rt4/etc/upgrade/reset-sequences&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;PERL5LIB=&amp;quot;/opt/rt4/lib:/opt/rt4/local/lib&amp;quot; /opt/rt4/etc/upgrade/reset-sequences&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; -- to create CachedMembers in database&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#* Resetting sequences is necessary especially for Postgres + data serialized with --clone.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;--force&lt;/ins&gt;&amp;lt;/code&amp;gt; -- to create CachedMembers in database&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===== Fix encoding patch =====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===== Fix encoding patch =====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-27203:rev-27212:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Phanousk</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27203&amp;oldid=prev</id>
		<title>Phanousk at 07:32, 23 July 2024</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27203&amp;oldid=prev"/>
		<updated>2024-07-23T07:32:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 03:32, 23 July 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l12&quot;&gt;Line 12:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 12:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-importer /var/tmp/serialized&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-importer /var/tmp/serialized&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;PERL5LIB=&amp;quot;/opt/rt4/lib:/opt/rt4/local/lib&amp;quot; /opt/rt4/etc/upgrade/reset-sequences&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;PERL5LIB=&amp;quot;/opt/rt4/lib:/opt/rt4/local/lib&amp;quot; /opt/rt4/etc/upgrade/reset-sequences&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; -- to create CachedMembers in database&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===== Fix encoding patch =====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===== Fix encoding patch =====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-27202:rev-27203:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Phanousk</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27202&amp;oldid=prev</id>
		<title>Phanousk: /* Converting the database from MySQL (MariaDB) to PostgreSQL */</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27202&amp;oldid=prev"/>
		<updated>2024-07-18T15:55:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Converting the database from MySQL (MariaDB) to PostgreSQL&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:55, 18 July 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l4&quot;&gt;Line 4:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This HowTo assume you have set-up some current production RT instance with MySQL or MariaDB database server and want to move it to PostgreSQL which should be more robust. So here we go:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This HowTo assume you have set-up some current production RT instance with MySQL or MariaDB database server and want to move it to PostgreSQL which should be more robust. So here we go:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Backup youre production database!&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Backup youre production database!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; to fix some garbage gathered through the years of upgrading your system. If you want to first check what it will do, just ommit the &amp;lt;code&amp;gt;--resolve&amp;lt;/code&amp;gt; option.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-- &lt;/ins&gt;to fix some garbage gathered through the years of upgrading your system. If you want to first check what it will do, just ommit the &amp;lt;code&amp;gt;--resolve&amp;lt;/code&amp;gt; option.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-serializer --clone --page 200 --directory /var/tmp/serialized --force --size 500 &amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-serializer --clone --page 200 --directory /var/tmp/serialized --force --size 500 &amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;drop database rtdb;&amp;quot;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;drop database rtdb;&amp;quot;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) optionally run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;ALTER USER postgres PASSWORD &amp;#039;some_password&amp;#039;;&amp;quot;&amp;lt;/code&amp;gt; -- you will need this password in next step&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) optionally run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;ALTER USER postgres PASSWORD &amp;#039;some_password&amp;#039;;&amp;quot;&amp;lt;/code&amp;gt; -- you will need this password in next step&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-setup-database --action create,schema,acl&amp;lt;/code&amp;gt; -- This works only when there is a &amp;lt;code&amp;gt;$DatabaseAdmin&amp;lt;/code&amp;gt; variable defined in RT_SiteConfig (or &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;RT_Configu&lt;/del&gt;). Usually this is set during the &amp;lt;code&amp;gt;./configure&amp;lt;/code&amp;gt; phase of RT installation.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-setup-database --action create,schema,acl&amp;lt;/code&amp;gt; -- This works only when there is a &amp;lt;code&amp;gt;$DatabaseAdmin&amp;lt;/code&amp;gt; variable defined in RT_SiteConfig (or &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;RT_Config&lt;/ins&gt;). Usually this is set during the &amp;lt;code&amp;gt;./configure&amp;lt;/code&amp;gt; phase of RT installation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;patch -d /opt/rt4/ -p1 &amp;lt; path/to/fix-importer-encoding-for-pg.patch&amp;lt;/code&amp;gt; -- Usually needed in non-english instances of RT. This patch is official by BP from year 2018 but surprisingly not present in current RTs in 2024 :).  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;patch -d /opt/rt4/ -p1 &amp;lt; path/to/fix-importer-encoding-for-pg.patch&amp;lt;/code&amp;gt; -- Usually needed in non-english instances of RT. This patch is official by BP from year 2018 but surprisingly not present in current RTs in 2024 :).  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-importer /var/tmp/serialized&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-importer /var/tmp/serialized&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-27201:rev-27202:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Phanousk</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27201&amp;oldid=prev</id>
		<title>Phanousk at 15:54, 18 July 2024</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27201&amp;oldid=prev"/>
		<updated>2024-07-18T15:54:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:54, 18 July 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Converting the database from MySQL (MariaDB) to PostgreSQL =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Converting the database from MySQL (MariaDB) to PostgreSQL =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;For some deeper details refer [[MigrateMysql2PostgresqlV4|older article]] about migrating.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This is a very straightforward article for set-up environment. &lt;/ins&gt;For some deeper details refer [[MigrateMysql2PostgresqlV4|older article]] about migrating.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This HowTo assume you have set-up some current production RT instance with MySQL or MariaDB database server and want to move it to PostgreSQL which should be more robust. So here we go:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This HowTo assume you have set-up some current production RT instance with MySQL or MariaDB database server and want to move it to PostgreSQL which should be more robust. So here we go:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-27200:rev-27201:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Phanousk</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27200&amp;oldid=prev</id>
		<title>Phanousk: new article</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ManualDatabaseConversion&amp;diff=27200&amp;oldid=prev"/>
		<updated>2024-07-18T15:53:52Z</updated>

		<summary type="html">&lt;p&gt;new article&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Converting the database from MySQL (MariaDB) to PostgreSQL =&lt;br /&gt;
For some deeper details refer [[MigrateMysql2PostgresqlV4|older article]] about migrating.&lt;br /&gt;
&lt;br /&gt;
This HowTo assume you have set-up some current production RT instance with MySQL or MariaDB database server and want to move it to PostgreSQL which should be more robust. So here we go:&lt;br /&gt;
# Backup youre production database!&lt;br /&gt;
# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-validator --check --resolve&amp;lt;/code&amp;gt; to fix some garbage gathered through the years of upgrading your system. If you want to first check what it will do, just ommit the &amp;lt;code&amp;gt;--resolve&amp;lt;/code&amp;gt; option.&lt;br /&gt;
# On current (MySQL) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-serializer --clone --page 200 --directory /var/tmp/serialized --force --size 500 &amp;lt;/code&amp;gt;&lt;br /&gt;
# On new (Postgres) run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;drop database rtdb;&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
# On new (Postgres) optionally run: &amp;lt;code&amp;gt;sudo -u postgres psql -c &amp;quot;ALTER USER postgres PASSWORD &amp;#039;some_password&amp;#039;;&amp;quot;&amp;lt;/code&amp;gt; -- you will need this password in next step&lt;br /&gt;
# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-setup-database --action create,schema,acl&amp;lt;/code&amp;gt; -- This works only when there is a &amp;lt;code&amp;gt;$DatabaseAdmin&amp;lt;/code&amp;gt; variable defined in RT_SiteConfig (or RT_Configu). Usually this is set during the &amp;lt;code&amp;gt;./configure&amp;lt;/code&amp;gt; phase of RT installation.&lt;br /&gt;
# On new (Postgres) run: &amp;lt;code&amp;gt;patch -d /opt/rt4/ -p1 &amp;lt; path/to/fix-importer-encoding-for-pg.patch&amp;lt;/code&amp;gt; -- Usually needed in non-english instances of RT. This patch is official by BP from year 2018 but surprisingly not present in current RTs in 2024 :). &lt;br /&gt;
# On new (Postgres) run: &amp;lt;code&amp;gt;/opt/rt4/sbin/rt-importer /var/tmp/serialized&amp;lt;/code&amp;gt;&lt;br /&gt;
# On new (Postgres) run: &amp;lt;code&amp;gt;PERL5LIB=&amp;quot;/opt/rt4/lib:/opt/rt4/local/lib&amp;quot; /opt/rt4/etc/upgrade/reset-sequences&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Fix encoding patch =====&lt;br /&gt;
 #cat fix-importer-encoding-for-pg.patch&lt;br /&gt;
 From 3b20d15fc798d2b3fd9c5667a074aa7cb22e14d9 Mon Sep 17 00:00:00 2001&lt;br /&gt;
 From: sunnavy &amp;lt;sunnavy@bestpractical.com&amp;gt;&lt;br /&gt;
 Date: Tue, 3 Jul 2018 03:26:36 +0800&lt;br /&gt;
 Subject: [PATCH] Always pass UTF-8 decoded data to Create method for rt-importer&lt;br /&gt;
 &lt;br /&gt;
 MySQL and Pg are different: serializer generates UTF-8 encoded bytes for&lt;br /&gt;
 MySQL and UTF-8 decoded string for Pg, respectively. This is not a&lt;br /&gt;
 problem if you stick to the same database, but when you try to migrate&lt;br /&gt;
 an RT db from MySQL to Pg, encoding issues could happen because Pg&lt;br /&gt;
 expects UTF-8 decoded values instead of encoded ones. MySQL on the other&lt;br /&gt;
 hand, isn&amp;#039;t that picky.&lt;br /&gt;
 &lt;br /&gt;
 This commit fixes this particular issue by always passing UTF-8 decoded string to Create.&lt;br /&gt;
 ---&lt;br /&gt;
 lib/RT/Migrate/Importer.pm | 9 +++++++++&lt;br /&gt;
 1 file changed, 9 insertions(+)&lt;br /&gt;
 &lt;br /&gt;
 diff --git a/lib/RT/Migrate/Importer.pm b/lib/RT/Migrate/Importer.pm&lt;br /&gt;
 index 6eef04532a..7a04bffef1 100644&lt;br /&gt;
 --- a/lib/RT/Migrate/Importer.pm&lt;br /&gt;
 +++ b/lib/RT/Migrate/Importer.pm&lt;br /&gt;
 @@ -319,6 +319,15 @@ sub Create {&lt;br /&gt;
     my ($id, $msg) = eval {&lt;br /&gt;
         # catch and rethrow on the outside so we can provide more info&lt;br /&gt;
         local $SIG{__DIE__};&lt;br /&gt;
 +&lt;br /&gt;
 +        # Make sure data passed to Create are UTF-8 decoded. Without this,&lt;br /&gt;
 +        # data could be be wrongly encoded on Pg.&lt;br /&gt;
 +        for my $field ( keys %$data ) {&lt;br /&gt;
 +            if ( $data-&amp;gt;{$field} &amp;amp;&amp;amp; !utf8::is_utf8( $data-&amp;gt;{$field} ) ) {&lt;br /&gt;
 +                utf8::decode( $data-&amp;gt;{$field} );&lt;br /&gt;
 +            }&lt;br /&gt;
 +        }&lt;br /&gt;
 +&lt;br /&gt;
         $obj-&amp;gt;DBIx::SearchBuilder::Record::Create(&lt;br /&gt;
             %{$data}&lt;br /&gt;
         );&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
===== Importer duplicate key error =====&lt;br /&gt;
If you encounter something like this:&lt;br /&gt;
 [warning]: DBD::Pg::st execute failed: ERROR:  duplicate key value violates unique constraint &amp;quot;users_pkey&amp;quot;&lt;br /&gt;
 DETAIL:  Key (id)=(26654) already exists. at /usr/local/share/perl/5.36.0/DBIx/SearchBuilder/Handle.pm line 634. &lt;br /&gt;
 (/usr/local/share/perl/5.36.0/DBIx/SearchBuilder/Handle.pm:634)&lt;br /&gt;
and the import can&amp;#039;t end succesfully, try this patch. It should be fixed in RT 5.0.8 and maybe in 4.4.8 also.&lt;br /&gt;
&lt;br /&gt;
 #cat Skip-unnecessary-post-actions-when-importing-cloned.patch&lt;br /&gt;
 diff --git a/lib/RT/Migrate/Importer.pm b/lib/RT/Migrate/Importer.pm&lt;br /&gt;
 index 946798bdb6..d3d3ec0171 100644&lt;br /&gt;
 --- a/lib/RT/Migrate/Importer.pm&lt;br /&gt;
 +++ b/lib/RT/Migrate/Importer.pm&lt;br /&gt;
 @@ -361,6 +361,8 @@ sub Create {&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     $self-&amp;gt;{ObjectCount}{$class}++;&lt;br /&gt;
 +    return $obj if $self-&amp;gt;{Clone};&lt;br /&gt;
 +&lt;br /&gt;
     $self-&amp;gt;Resolve( $uid =&amp;gt; $class, $id );&lt;br /&gt;
 &lt;br /&gt;
     # Load it back to get real values into the columns&lt;/div&gt;</summary>
		<author><name>Phanousk</name></author>
	</entry>
</feed>