{"record":{"id":"13a43d4282b8d733","repo":"hasura/graphql-engine","slug":"removing-up-original-migrations-w","errorCode":null,"errorMessage":"removing up original migrations: %w","messagePattern":"removing up original migrations: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/internal/scripts/update-project-v3.go","lineNumber":224,"sourceCode":"\tnewConfig := *opts.EC.Config\n\n\tnewConfig.Version = cli.V3\n\tif err := opts.EC.WriteConfig(&newConfig); err != nil {\n\t\treturn errors.E(op, err)\n\t}\n\n\topts.EC.Config = &newConfig\n\topts.EC.Logger.Debug(\"completed: generate new config file\")\n\n\topts.EC.Logger.Debug(\"start: delete old migrations and seeds\")\n\topts.EC.Spin(\"Cleaning project directory \")\n\t// delete original migrations\n\tif err := removeDirectories(\n\t\topts.Fs,\n\t\topts.MigrationsAbsDirectoryPath,\n\t\tmigrationDirectoriesToMove,\n\t); err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"removing up original migrations: %w\", err))\n\t}\n\t// delete original seeds\n\tif err := removeDirectories(opts.Fs, opts.SeedsAbsDirectoryPath, seedFilesToMove); err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"removing up original migrations: %w\", err))\n\t}\n\t// remove functions.yaml and tables.yaml files\n\tmetadataFiles := []string{\"functions.yaml\", \"tables.yaml\"}\n\tif err := removeDirectories(opts.Fs, opts.EC.MetadataDir, metadataFiles); err != nil {\n\t\treturn errors.E(op, err)\n\t}\n\n\topts.EC.Logger.Debug(\"completed: delete old migrations and seeds\")\n\n\topts.EC.Logger.Debug(\"start: export metadata from server\")\n\topts.EC.Spin(\"Exporting metadata from server \")\n\n\tvar files map[string][]byte\n","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/internal/scripts/update-project-v3.go#L206-L242","documentation":"After copying migrations into the new structure, UpdateProjectV3 failed deleting the original migration directories (removeDirectories). The message ('removing up original migrations') is used for the migrations removal step.","triggerScenarios":"`hasura scripts update-project-v3` when an original migration directory under opts.MigrationsAbsDirectoryPath cannot be removed (permissions, non-empty due to hidden files, file locks).","commonSituations":"Windows file locks from editors/AV, read-only attributes, or files created in migration dirs by other tools during the upgrade.","solutions":["Check the wrapped remove error for the specific path; close programs locking it","Fix write permissions on the migrations directory (removal requires directory write access)","Manually remove the leftover directories and re-run or continue the setup manually","Re-run the script from a clean checkout"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := scripts.UpdateProjectV3(opts); err != nil {\n    if strings.Contains(err.Error(), \"removing up original migrations\") { /* check locks/perm on migrations dir, finish cleanup manually */ }\n}","preventionTips":["Close file-locking tools before running","Ensure directory write permission (needed for deletes)","Verify final structure manually if cleanup failed but copies succeeded"],"tags":["filesystem","remove","migrations","hasura-cli"],"backgroundTag":"file-delete-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}