{"record":{"id":"b18f21d775497379","repo":"hasura/graphql-engine","slug":"down-migration-with-sql-string-could-not-be-create","errorCode":null,"errorMessage":"down migration with SQL string could not be created: %w","messagePattern":"down migration with SQL string could not be created: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_create.go","lineNumber":275,"sourceCode":"\t}\n\n\t// create pure sql based migrations here\n\tif o.upSQLChanged {\n\t\terr = createOptions.SetSQLUp(o.upSQL)\n\t\tif err != nil {\n\t\t\treturn 0, herrors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"up migration with SQL string could not be created: %w\", err),\n\t\t\t)\n\t\t}\n\t}\n\n\tif o.downSQLChanged {\n\t\terr = createOptions.SetSQLDown(o.downSQL)\n\t\tif err != nil {\n\t\t\treturn 0, herrors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"down migration with SQL string could not be created: %w\", err),\n\t\t\t)\n\t\t}\n\t}\n\n\tif o.sqlFile == \"\" && !o.sqlServer && o.EC.Config.Version != cli.V1 {\n\t\t// Set empty data for [up|down].sql\n\t\tif !o.upSQLChanged {\n\t\t\tcreateOptions.SQLUp = []byte(``)\n\t\t}\n\n\t\tif !o.downSQLChanged {\n\t\t\tcreateOptions.SQLDown = []byte(``)\n\t\t}\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr := createOptions.Delete()","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_create.go#L257-L293","documentation":"Mirror of error 116 for the --down flag: createOptions.SetSQLDown(o.downSQL) failed while validating/storing the down SQL string, typically because it is empty or whitespace-only.","triggerScenarios":"`hasura migrate create X --down \"\"` or --down \"$DOWN\" with DOWN unset/empty.","commonSituations":"Scripts that always pass both --up and --down but the down variable is conditionally empty.","solutions":["Verify the --down value is non-empty SQL","Omit --down entirely if no down migration is needed (a default empty down may be created)","Fix shell quoting/variable expansion"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"[ -n \"$(echo \"$DOWN_SQL\" | tr -d '[:space:]')\" ] || { echo 'empty --down'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit --down when no down migration exists","Validate both up/down variables in wrappers"],"tags":["migrate-create","sql-validation","cli-usage"],"backgroundTag":"empty-migration-sql","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}