0

im not really sure what is going on to be honest. I was given a project to take over and I am following the steps in the README

this is the step is giving me an issue is the following:

You can create a new database from the migrations in this project, the command is:

node ace migration:run

my understanding is that i am creating the database records in the mysql instance

Once I run node ace migration:run everything works fine for a while until i hit the following issues:

....
....
...
❯ migrated database/migrations/1661521523093_phone_numbers
❯ migrated database/migrations/1663691668347_voice_calls
❯ migrated database/migrations/1665766850905_settings
❯ error database/migrations/1667928559943_leads
❯ migrating database/migrations/1672847283595_users
[ error ]  CREATE INDEX payload_idx USING BTREE ON leads (payload_json) - ER_JSON_USED_AS_KEY: JSON column 'payload_json' supports indexing only via generated columns on a specified JSON path.
    at Query.Sequence._packetToError (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Query.ErrorPacket (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)
    at Protocol._parsePacket (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/Connection.js:88:28)
    at Socket.<anonymous> (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/Connection.js:526:10)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    --------------------
    at Protocol._enqueue (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Connection.query (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/mysql/lib/Connection.js:198:25)
    at /Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/knex/lib/dialects/mysql/index.js:132:18
    at new Promise (<anonymous>)
    at Client_MySQL._query (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/knex/lib/dialects/mysql/index.js:126:12)
    at executeQuery (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/knex/lib/execution/internal/query-executioner.js:37:17)
    at Client_MySQL.query (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/knex/lib/client.js:144:12)
    at /Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/knex/lib/execution/transaction.js:363:24
    at new Promise (<anonymous>)
    at Client_MySQL.trxClient.query (/Users/juancasas/Desktop/studio code/lead-axis/lead-axis-back/node_modules/knex/lib/execution/transaction.js:358:12)

I found the following stackoverflow post that contains the same error BUT they dont explain what code they ran to solve the error: ER_JSON_USED_AS_KEY: JSON column 'parent_ids' supports indexing only via generated columns on a specified JSON path

i tried to run the following code in mysql workbench but I didnt get it to work

ALTER TABLE leads
DROP CONSTRAINT payload_json;

this is the response in mysql::

Error Code: 3940. Constraint 'payload_json' does not exist.

this is the ace file:

require('reflect-metadata')
require('source-map-support').install({ handleUncaughtExceptions: false })

const { Ignitor } = require('@adonisjs/core/build/standalone')
new Ignitor(__dirname)
  .ace()
  .handle(process.argv.slice(2))

any advice is welcomed

Juan Casas
  • 268
  • 2
  • 13

0 Answers0