@omnifyjp/ts 1.1.3 → 1.1.4

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.
@@ -38,7 +38,7 @@ export function buildRelation(propName, property, modelNamespace, context) {
38
38
  /** Generate pivot table name matching Go's GeneratePivotTableName logic. */
39
39
  export function generatePivotTableName(sourceTable, targetTable) {
40
40
  const tables = [singularize(sourceTable), singularize(targetTable)].sort();
41
- return tables.join('_');
41
+ return tables.join('_') + '_pivot';
42
42
  }
43
43
  /** Get the return type hint for a relation. */
44
44
  export function getReturnType(relation) {
@@ -14,6 +14,17 @@ export function generateServiceProvider(reader, config) {
14
14
  }
15
15
  morphEntries.sort();
16
16
  const morphMapContent = morphEntries.join('\n');
17
+ // Build package migration loading lines
18
+ const packageMigrationLines = [];
19
+ const packages = reader.getPackages();
20
+ for (const [name, pkg] of Object.entries(packages)) {
21
+ if (pkg.migrationsPath) {
22
+ packageMigrationLines.push(` $this->loadMigrationsFrom(base_path('${pkg.migrationsPath}')); // ${name}`);
23
+ }
24
+ }
25
+ const packageMigrationsBlock = packageMigrationLines.length > 0
26
+ ? `\n // Load package migrations\n${packageMigrationLines.join('\n')}\n`
27
+ : '';
17
28
  const providerNamespace = config.providers.namespace;
18
29
  const content = `<?php
19
30
 
@@ -50,7 +61,7 @@ class OmnifyServiceProvider extends ServiceProvider
50
61
  {
51
62
  // Load Omnify migrations from custom directory
52
63
  $this->loadMigrationsFrom(database_path('migrations/omnify'));
53
-
64
+ ${packageMigrationsBlock}
54
65
  // Register morph map for polymorphic relationships
55
66
  Relation::enforceMorphMap([
56
67
  ${morphMapContent}
package/dist/types.d.ts CHANGED
@@ -27,6 +27,7 @@ export interface SchemasJson {
27
27
  }
28
28
  /** Package metadata in schemas.json (codegen namespace references). */
29
29
  export interface PackageExportInfo {
30
+ readonly migrationsPath?: string;
30
31
  readonly codegen?: PackageCodegenExport;
31
32
  }
32
33
  /** Codegen namespace info from a package. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnifyjp/ts",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "TypeScript model type generator from Omnify schemas.json",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",