@atlashub/smartstack-cli 4.36.0 → 4.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28585,6 +28585,7 @@ async function handleCheckMigrations(args, config2) {
28585
28585
  );
28586
28586
  }
28587
28587
  await checkModelSnapshot(result, structure);
28588
+ await checkSqlObjectsInjection(result, structure);
28588
28589
  result.hasConflicts = result.conflicts.length > 0;
28589
28590
  generateSuggestions(result);
28590
28591
  return formatResult2(result, currentBranch, input.compareBranch);
@@ -28754,6 +28755,24 @@ async function checkModelSnapshot(result, structure) {
28754
28755
  }
28755
28756
  }
28756
28757
  }
28758
+ async function checkSqlObjectsInjection(result, structure) {
28759
+ if (!structure.migrations || !structure.infrastructure) return;
28760
+ const sqlObjectsPath = path9.join(structure.infrastructure, "Persistence", "SqlObjects");
28761
+ const sqlFiles = await findFiles("**/*.sql", { cwd: sqlObjectsPath }).catch(() => []);
28762
+ if (sqlFiles.length === 0) return;
28763
+ for (const migration of result.migrations) {
28764
+ const migrationPath = path9.join(structure.root, migration.file);
28765
+ const content = await readText(migrationPath).catch(() => "");
28766
+ if (content && !content.includes("SqlObjectHelper.ApplyAll")) {
28767
+ result.conflicts.push({
28768
+ type: "sql_objects",
28769
+ description: `Migration "${migration.name}" is MISSING SqlObjectHelper.ApplyAll(migrationBuilder) \u2014 ${sqlFiles.length} SQL object(s) found in SqlObjects/ will NOT be deployed`,
28770
+ files: [migration.file, ...sqlFiles.map((f) => path9.relative(structure.root, f))],
28771
+ resolution: 'Add "using SmartStack.Infrastructure.Persistence.SqlObjects;" at top and "SqlObjectHelper.ApplyAll(migrationBuilder);" at end of Up() method. Without this, TVFs/views/SPs will not exist in the database and cause runtime 500 errors.'
28772
+ });
28773
+ }
28774
+ }
28775
+ }
28757
28776
  function generateSuggestions(result) {
28758
28777
  if (result.conflicts.some((c) => c.type === "snapshot")) {
28759
28778
  result.suggestions.push(
@@ -28770,6 +28789,11 @@ function generateSuggestions(result) {
28770
28789
  "Ensure migrations are created in version order to avoid conflicts"
28771
28790
  );
28772
28791
  }
28792
+ if (result.conflicts.some((c) => c.type === "sql_objects")) {
28793
+ result.suggestions.push(
28794
+ "CRITICAL: Migrations missing SqlObjectHelper.ApplyAll(migrationBuilder) will cause ALL API endpoints to return 500 at runtime. Fix immediately."
28795
+ );
28796
+ }
28773
28797
  if (result.migrations.length > 20) {
28774
28798
  result.suggestions.push(
28775
28799
  "Consider squashing old migrations to reduce complexity. Use: /efcore squash"
@@ -28803,7 +28827,7 @@ function formatResult2(result, currentBranch, compareBranch) {
28803
28827
  lines.push("## Conflicts");
28804
28828
  lines.push("");
28805
28829
  for (const conflict of result.conflicts) {
28806
- const icon = conflict.type === "snapshot" ? "\u{1F504}" : conflict.type === "order" ? "\u{1F4C5}" : conflict.type === "naming" ? "\u{1F4DD}" : "\u26A0\uFE0F";
28830
+ const icon = conflict.type === "snapshot" ? "\u{1F504}" : conflict.type === "order" ? "\u{1F4C5}" : conflict.type === "naming" ? "\u{1F4DD}" : conflict.type === "sql_objects" ? "\u{1F6A8}" : "\u26A0\uFE0F";
28807
28831
  lines.push(`### ${icon} ${conflict.type.toUpperCase()}: ${conflict.description}`);
28808
28832
  if (conflict.files.length > 0) {
28809
28833
  lines.push(`- **Files**: ${conflict.files.map((f) => `\`${f}\``).join(", ")}`);