strapi / migration-scripts

Collection of Strapi Migration scripts
58 stars 58 forks source link

Error and invalid result migrating localizations #29

Closed AAS97 closed 2 years ago

AAS97 commented 2 years ago

Bug report

Required System information

Describe the bug

Running v3-sql-v4-sql migration, got an error on table contentName_localizations migration. For some data models : no error but invalid results (only contentName_id column is populated) For some data models : get error : column "contentName_id" of relation "contentName_localizations_links" does not exist

Steps to reproduce the behavior

  1. Run yarn start

Expected behavior

Should migrate localizations without errors

Code snippets

Migrating 2 items from companies__localizations to companies_localizations_links
companies__localizations batch #1
/scripts/strapi_migrations/migration-scripts/v3-sql-v4-sql/node_modules/pg-protocol/dist/parser.js:287
        const message = name === 'notice' ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);
                                                                                                 ^

error: insert into "companies_localizations_links" ("company_id", "related_company_id") values ($1, $2), ($3, $4) - column "related_company_id" of relation "companies_localizations_links" does not exist
    at Parser.parseErrorMessage (/scripts/strapi_migrations/migration-scripts/v3-sql-v4-sql/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/scripts/strapi_migrations/migration-scripts/v3-sql-v4-sql/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/scripts/strapi_migrations/migration-scripts/v3-sql-v4-sql/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/scripts/strapi_migrations/migration-scripts/v3-sql-v4-sql/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:199:23) {
  length: 160,
  severity: 'ERROR',
  code: '42703',
  detail: undefined,
  hint: undefined,
  position: '60',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_target.c',
  line: '1066',
  routine: 'checkInsertTargets'
}
error Command failed with exit code 1.
derrickmehaffy commented 2 years ago

As related to the other issue I tried to reproduce issues with migrations of localized entries and could not:


Can't reproduce currently, here is a 7 minute video with me going through the process of migration for localization. If I missed anything please feel free to let me know.

https://www.loom.com/share/f7dbe172df154a5d8be22d466d6ccb8d

derrickmehaffy commented 2 years ago

Since we are unable to reproduce, I'm going to close this. If you have new information please share and we can reopen.