@famgia/omnify 1.0.126 → 1.0.127

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.
@@ -908,6 +908,62 @@ organizations:
908
908
  > ```
909
909
  > Just write the value directly without wrapping in quotes!
910
910
 
911
+ > ⚠️ **CRITICAL: Database Function Keywords NOT Allowed in Default**
912
+ >
913
+ > Database-specific function keywords are NOT allowed in the `default` field.
914
+ > Use the appropriate schema options instead:
915
+ >
916
+ > ```yaml
917
+ > # ❌ WRONG - DB functions are not allowed
918
+ > failed_at:
919
+ > type: Timestamp
920
+ > default: CURRENT_TIMESTAMP # ERROR!
921
+ >
922
+ > created_at:
923
+ > type: DateTime
924
+ > default: NOW() # ERROR!
925
+ >
926
+ > external_id:
927
+ > type: Uuid
928
+ > default: UUID() # ERROR!
929
+ >
930
+ > sort_order:
931
+ > type: Int
932
+ > default: AUTO_INCREMENT # ERROR!
933
+ >
934
+ > # ✅ CORRECT - Use proper schema options
935
+ > failed_at:
936
+ > type: Timestamp
937
+ > useCurrent: true # Equivalent to CURRENT_TIMESTAMP
938
+ >
939
+ > updated_at:
940
+ > type: Timestamp
941
+ > useCurrent: true
942
+ > useCurrentOnUpdate: true # ON UPDATE CURRENT_TIMESTAMP
943
+ >
944
+ > external_id:
945
+ > type: Uuid
946
+ > nullable: true # Let application generate UUID
947
+ >
948
+ > sort_order:
949
+ > type: Int
950
+ > default: 0 # Use static value
951
+ > ```
952
+ >
953
+ > **Valid Default Values by Type:**
954
+ > | Type | Valid Default | Invalid (DB Keywords) |
955
+ > |------|---------------|----------------------|
956
+ > | String, Text | Any static string | - |
957
+ > | Int, BigInt | Static integer (0, 100, -1) | AUTO_INCREMENT, RAND(), SERIAL |
958
+ > | Float, Decimal | Static number (0.0, 99.99) | RAND(), PI() |
959
+ > | Boolean | true, false, 1, 0 | - |
960
+ > | Date | YYYY-MM-DD (2024-01-01) | CURRENT_DATE, CURDATE() |
961
+ > | Time | HH:MM:SS (14:30:00) | CURRENT_TIME, CURTIME() |
962
+ > | DateTime | YYYY-MM-DD HH:MM:SS | CURRENT_TIMESTAMP, NOW() |
963
+ > | Timestamp | YYYY-MM-DD HH:MM:SS or use `useCurrent` | CURRENT_TIMESTAMP, NOW() |
964
+ > | Uuid | Static UUID string | UUID(), GEN_RANDOM_UUID() |
965
+ > | Enum | One of the enum values | - |
966
+
911
967
  **Generated Migration:**
912
968
  ```php
913
969
  Schema::create('organization_user', function (Blueprint $table) {
@@ -1126,13 +1182,13 @@ properties:
1126
1182
 
1127
1183
  ### Rules for Partial Schemas
1128
1184
 
1129
- | Rule | Description |
1130
- |------|-------------|
1131
- | `kind: partial` | Required to mark as partial schema |
1132
- | `target: SchemaName` | Required - specifies which schema to extend |
1133
- | `properties` | Required - at least one property |
1134
- | `options` | ❌ Not allowed (table options belong to target) |
1135
- | `values` | ❌ Not allowed (that's for enums) |
1185
+ | Rule | Description |
1186
+ | -------------------- | ---------------------------------------------- |
1187
+ | `kind: partial` | Required to mark as partial schema |
1188
+ | `target: SchemaName` | Required - specifies which schema to extend |
1189
+ | `properties` | Required - at least one property |
1190
+ | `options` | ❌ Not allowed (table options belong to target) |
1191
+ | `values` | ❌ Not allowed (that's for enums) |
1136
1192
 
1137
1193
  ### Use Cases
1138
1194
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@famgia/omnify",
3
- "version": "1.0.126",
3
+ "version": "1.0.127",
4
4
  "description": "Schema-driven database migration system with TypeScript types and Laravel migrations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,14 +26,14 @@
26
26
  "README.md"
27
27
  ],
28
28
  "dependencies": {
29
- "@famgia/omnify-typescript": "0.0.104",
30
- "@famgia/omnify-laravel": "0.0.125",
31
- "@famgia/omnify-atlas": "0.0.110",
32
- "@famgia/omnify-mcp": "0.0.102",
33
- "@famgia/omnify-cli": "0.0.122",
34
- "@famgia/omnify-types": "0.0.114",
35
- "@famgia/omnify-core": "0.0.116",
36
- "@famgia/omnify-japan": "0.0.109"
29
+ "@famgia/omnify-cli": "0.0.123",
30
+ "@famgia/omnify-core": "0.0.117",
31
+ "@famgia/omnify-types": "0.0.115",
32
+ "@famgia/omnify-laravel": "0.0.126",
33
+ "@famgia/omnify-atlas": "0.0.111",
34
+ "@famgia/omnify-mcp": "0.0.103",
35
+ "@famgia/omnify-typescript": "0.0.105",
36
+ "@famgia/omnify-japan": "0.0.110"
37
37
  },
38
38
  "keywords": [
39
39
  "omnify",
@@ -908,6 +908,62 @@ organizations:
908
908
  > ```
909
909
  > Just write the value directly without wrapping in quotes!
910
910
 
911
+ > ⚠️ **CRITICAL: Database Function Keywords NOT Allowed in Default**
912
+ >
913
+ > Database-specific function keywords are NOT allowed in the `default` field.
914
+ > Use the appropriate schema options instead:
915
+ >
916
+ > ```yaml
917
+ > # ❌ WRONG - DB functions are not allowed
918
+ > failed_at:
919
+ > type: Timestamp
920
+ > default: CURRENT_TIMESTAMP # ERROR!
921
+ >
922
+ > created_at:
923
+ > type: DateTime
924
+ > default: NOW() # ERROR!
925
+ >
926
+ > external_id:
927
+ > type: Uuid
928
+ > default: UUID() # ERROR!
929
+ >
930
+ > sort_order:
931
+ > type: Int
932
+ > default: AUTO_INCREMENT # ERROR!
933
+ >
934
+ > # ✅ CORRECT - Use proper schema options
935
+ > failed_at:
936
+ > type: Timestamp
937
+ > useCurrent: true # Equivalent to CURRENT_TIMESTAMP
938
+ >
939
+ > updated_at:
940
+ > type: Timestamp
941
+ > useCurrent: true
942
+ > useCurrentOnUpdate: true # ON UPDATE CURRENT_TIMESTAMP
943
+ >
944
+ > external_id:
945
+ > type: Uuid
946
+ > nullable: true # Let application generate UUID
947
+ >
948
+ > sort_order:
949
+ > type: Int
950
+ > default: 0 # Use static value
951
+ > ```
952
+ >
953
+ > **Valid Default Values by Type:**
954
+ > | Type | Valid Default | Invalid (DB Keywords) |
955
+ > |------|---------------|----------------------|
956
+ > | String, Text | Any static string | - |
957
+ > | Int, BigInt | Static integer (0, 100, -1) | AUTO_INCREMENT, RAND(), SERIAL |
958
+ > | Float, Decimal | Static number (0.0, 99.99) | RAND(), PI() |
959
+ > | Boolean | true, false, 1, 0 | - |
960
+ > | Date | YYYY-MM-DD (2024-01-01) | CURRENT_DATE, CURDATE() |
961
+ > | Time | HH:MM:SS (14:30:00) | CURRENT_TIME, CURTIME() |
962
+ > | DateTime | YYYY-MM-DD HH:MM:SS | CURRENT_TIMESTAMP, NOW() |
963
+ > | Timestamp | YYYY-MM-DD HH:MM:SS or use `useCurrent` | CURRENT_TIMESTAMP, NOW() |
964
+ > | Uuid | Static UUID string | UUID(), GEN_RANDOM_UUID() |
965
+ > | Enum | One of the enum values | - |
966
+
911
967
  **Generated Migration:**
912
968
  ```php
913
969
  Schema::create('organization_user', function (Blueprint $table) {