mattermost / migration-assist

A helper tool to automate MySQL -> Postgres migration for Mattermost
https://docs.mattermost.com/deploy/postgres-migration.html
2 stars 2 forks source link

Database error 42P01: Relation mattermost.focalboard_blocks does not exist #32

Open danielschubert opened 3 weeks ago

danielschubert commented 3 weeks ago

on pgloader boards.load > boards.log this happens:

FATAL error: Database error 42P01: Relation mattermost.focalboard_blocks existiert nicht
QUERY: UPDATE mattermost.focalboard_blocks SET "fields" = '{}'::json WHERE "fields"::text = '';
An unhandled error condition has been signalled:
   Database error 42P01: Relation mattermost.focalboard_blocks existiert nicht
QUERY: UPDATE mattermost.focalboard_blocks SET "fields" = '{}'::json WHERE "fields"::text = '';

What I am doing here?

Database error 42P01: Relation mattermost.focalboard_blocks existiert nicht
QUERY: UPDATE mattermost.focalboard_blocks SET "fields" = '{}'::json WHERE "fields"::text = '';
isacikgoz commented 3 weeks ago

Thanks for reporting this @danielschubert Can you share the structure of focalboard_blocks table in the postgres database (and also it should be in the mattermost schema)?

\d focalboard_blocks

Ideally it should've been created by the pgloader because the recommended configuration has create tables clause. Can you also share your configuration file for focalboard (eg. boards.load file)?

danielschubert commented 2 weeks ago

pgloader does not create this table in the first place.

my boards.load:

LOAD DATABASE
    FROM       mysql://xxxxx:s3cr3t@localhost:3306/mattermost
    INTO       pgsql://mattermost:s3cr3t@localhost:5432/mattermost

WITH include drop, create tables, create indexes, reset sequences,
    workers = 8, concurrency = 1,
    multiple readers per thread, rows per range = 50000,
    preserve index names

SET PostgreSQL PARAMETERS
    maintenance_work_mem to '128MB',
    work_mem to '12MB'

SET MySQL PARAMETERS
    net_read_timeout  = '120',
    net_write_timeout = '120'

CAST column focalboard_blocks.fields to "json" drop typemod,
     column focalboard_blocks_history.fields to "json" drop typemod,
     column focalboard_schema_migrations.name to "varchar" drop typemod,
     column focalboard_sessions.props to "json" drop typemod using remove-null-characters,
     column focalboard_teams.settings to "json" drop typemod using remove-null-characters,
     column focalboard_users.props to "json" drop typemod using remove-null-characters,
     type int when (= precision 11) to int4 drop typemod,
     type json to jsonb drop typemod using remove-null-characters

INCLUDING ONLY TABLE NAMES MATCHING
    ~/focalboard/

AFTER LOAD DO
    $$ UPDATE mattermost.focalboard_blocks SET "fields" = '{}'::json WHERE "fields"::text = ''; $$,
    $$ UPDATE mattermost.focalboard_blocks_history SET "fields" = '{}'::json WHERE "fields"::text = ''; $$,
    $$ UPDATE mattermost.focalboard_sessions SET "props" = '{}'::json WHERE "props"::text = ''; $$,
    $$ UPDATE mattermost.focalboard_teams SET "settings" = '{}'::json WHERE "settings"::text = ''; $$,
    $$ UPDATE mattermost.focalboard_users SET "props" = '{}'::json WHERE "props"::text = ''; $$,
    $$ ALTER SCHEMA mattermost RENAME TO public; $$,
    $$ SELECT pg_catalog.set_config('search_path', '"$user", """$user"", public"', false); $$,
    $$ ALTER USER mattermost SET SEARCH_PATH TO '"""$user"", public"'; $$;
isacikgoz commented 1 week ago

@danielschubert It should create the tables, because there is create tables clause in the configuration. Can you please check if there is any other errors on the pgloader logs? It would be great if you can share full logs.