strapi / migration-scripts

Collection of Strapi Migration scripts
58 stars 57 forks source link

PostgreSQL - violates not-null constraint #94

Closed Siddhesh-Nalawade closed 1 year ago

Siddhesh-Nalawade commented 1 year ago

Bug report

Required System information

Describe the bug

I am trying to migrate Strapi v3 with MongoDB to Strapi v3 Postgres. But I am getting the following error:

error: insert into "modules_components" ("component_id", "component_type", "field", "id", "module_id", "order") values (DEFAULT, $1, $2, $3, $4, $5) - null value in column "component_id" of relation "modules_components" violates not-null constraint
    at Parser.parseErrorMessage (/home/siddhesh/Projects/cssoch/migration-scripts/v3-mongodb-v3-sql/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/home/siddhesh/Projects/cssoch/migration-scripts/v3-mongodb-v3-sql/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/home/siddhesh/Projects/cssoch/migration-scripts/v3-mongodb-v3-sql/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/home/siddhesh/Projects/cssoch/migration-scripts/v3-mongodb-v3-sql/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:527: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:190:23) {
  length: 282,
  severity: 'ERROR',
  code: '23502',
  detail: 'Failing row contains (130, Project, 1, components_project_projects, null, 38).',
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: 'public',
  table: 'modules_components',
  column: 'component_id',
  dataType: undefined,
  constraint: undefined,
  file: 'execMain.c',
  line: '1883',
  routine: 'ExecConstraints'
}

I am not getting the cause of the error. Whether it causing because by the script or because of data.

Siddhesh-Nalawade commented 1 year ago

There was an issue in the data which is causing errors. Sorry for not checking it properly.