Drizzle kit schema migration with mysql ; Rerunning the entire schema

I use mysql2 as my database and when i run my migrate script "migrate": "drizzle-kit push:mysql --config drizzle.config.ts" this works fine but when i rerun my migrate script i get this error
Error: Duplicate key name 'company_id'
    at PromiseConnection.query (/home/anasmohammed361/vs/fund-master/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs:35481:26)
    at Command.<anonymous> (/home/anasmohammed361/vs/fund-master/node_modules/.pnpm/drizzle-kit@0.19.13/node_modules/drizzle-kit/index.cjs:53292:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ER_DUP_KEYNAME',
  errno: 1061,
  sql: 'CREATE INDEX `company_id` ON `company` (`id`);',
  sqlState: '42000',
  sqlMessage: "Duplicate key name 'company_id'" 
Was this page helpful?