{"record":{"id":"c2649221233f3480","repo":"remix-run/remix","slug":"migration-directory-directoryname-is-missing-u","errorCode":null,"errorMessage":"Migration directory \"{directoryName}\" is missing up.sql","messagePattern":"Migration directory \"(.+?)\" is missing up\\.sql","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/data-table/src/lib/migrations-node.ts","lineNumber":58,"sourceCode":"          parsed.id +\n          '\" inferred from directory \"' +\n          directoryName +\n          '\"',\n      )\n    }\n\n    seenIds.add(parsed.id)\n\n    let directoryPath = path.join(directory, directoryName)\n    let upPath = path.join(directoryPath, 'up.sql')\n    let downPath = path.join(directoryPath, 'down.sql')\n\n    let up: string\n    try {\n      up = await fs.readFile(upPath, 'utf8')\n    } catch (error) {\n      if (isNodeFileNotFoundError(error)) {\n        throw new Error('Migration directory \"' + directoryName + '\" is missing up.sql')\n      }\n      throw error\n    }\n\n    let down: string | undefined\n    try {\n      down = await fs.readFile(downPath, 'utf8')\n    } catch (error) {\n      if (!isNodeFileNotFoundError(error)) {\n        throw error\n      }\n    }\n\n    migrations.push({\n      id: parsed.id,\n      name: parsed.name,\n      up,\n      down,","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/data-table/src/lib/migrations-node.ts#L40-L76","documentation":"Each migration directory must contain an up.sql file defining the forward migration. loadMigrations reads it with fs.readFile and, when the failure is a Node ENOENT (file not found), throws an Error stating the directory is missing up.sql. down.sql is optional, but up.sql is mandatory.","triggerScenarios":"A migration directory containing only down.sql, a .gitkeep, or nothing; committing a migration before creating up.sql; typos in the filename (Up.sql, up.TXT) which read as missing on case-sensitive filesystems.","commonSituations":"Partial commits where up.sql was ignored by .gitignore; hand-creating a migration directory without the generator; renaming files with editors that change case; deploying to Linux after developing on macOS/Windows (case sensitivity).","solutions":["Create up.sql in the flagged directory with the forward SQL (e.g. CREATE TABLE ...)","Check .gitignore / git status to be sure up.sql is actually committed","Verify the filename is exactly up.sql with lowercase extension"],"exampleFix":"# before\nmigrations/20240101000000_add_users/\n  down.sql\n\n# after\nmigrations/20240101000000_add_users/\n  up.sql     # CREATE TABLE users (...);\n  down.sql","handlingStrategy":"validation","validationCode":"for (let dir of directories) {\n  if (!existsSync(path.join(migrationsDir, dir, 'up.sql'))) {\n    throw new Error(`${dir} is missing up.sql`)\n  }\n}","typeGuard":"function isCompleteMigrationDirectory(files: string[]): boolean {\n  return files.includes('up.sql')\n}","tryCatchPattern":null,"preventionTips":["Always use the migration generator rather than hand-creating directories","Ensure up.sql is committed (check .gitignore) and named exactly lowercase","Run migrations in CI on a case-sensitive filesystem (Linux) to catch naming issues"],"tags":["data-table","migrations","missing-file","filesystem"],"backgroundTag":"missing-migration-file","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}