@autobe/agent 0.10.1 → 0.10.3
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.
- package/lib/index.mjs +83 -74
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +47 -40
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +47 -40
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +12 -20
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/package.json +6 -6
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +1 -1
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +12 -20
|
@@ -295,23 +295,8 @@ const claude = {
|
|
|
295
295
|
type: "string"
|
|
296
296
|
},
|
|
297
297
|
relation: {
|
|
298
|
-
description: "Prisma relation configuration defining the association details.\n\nSpecifies how this foreign key connects to the target model, including\nrelation name, target model, and target field.",
|
|
299
|
-
|
|
300
|
-
properties: {
|
|
301
|
-
name: {
|
|
302
|
-
description: "Name of the relation property in the Prisma model.\n\nUsed to access the related model instance. Usually a descriptive name\nof the relationship. Examples: \"customer\", \"channel\", \"parent\",\n\"snapshot\"",
|
|
303
|
-
type: "string",
|
|
304
|
-
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$"
|
|
305
|
-
},
|
|
306
|
-
targetModel: {
|
|
307
|
-
description: "Name of the target model being referenced.\n\nMust match exactly with an existing model name in the schema. Examples:\n\"shopping_customers\", \"shopping_channels\", \"bbs_articles\"",
|
|
308
|
-
type: "string"
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
required: [
|
|
312
|
-
"name",
|
|
313
|
-
"targetModel"
|
|
314
|
-
]
|
|
298
|
+
description: "Prisma relation configuration defining the association details.\n\nSpecifies how this foreign key connects to the target model, including\nrelation name, target model, and target field. This configuration is used\nto generate the appropriate Prisma relation directive in the schema.",
|
|
299
|
+
$ref: "#/$defs/AutoBePrisma.IRelation"
|
|
315
300
|
},
|
|
316
301
|
unique: {
|
|
317
302
|
description: "Whether this foreign key has a unique constraint.\n\nTrue: Creates a 1:1 relationship (e.g., user profile, order publish\ndetails) false: Allows 1:N relationship (e.g., customer to multiple\norders) Used for enforcing business rules about relationship\ncardinality.",
|
|
@@ -331,6 +316,25 @@ const claude = {
|
|
|
331
316
|
"nullable"
|
|
332
317
|
]
|
|
333
318
|
},
|
|
319
|
+
"AutoBePrisma.IRelation": {
|
|
320
|
+
description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
|
|
321
|
+
type: "object",
|
|
322
|
+
properties: {
|
|
323
|
+
name: {
|
|
324
|
+
description: "Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- \"customer\" for shopping_customer_id field\n- \"channel\" for shopping_channel_id field\n- \"parent\" for parent_id field in hierarchical structures\n- \"snapshot\" for versioning relationships\n- \"article\" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship's business\nmeaning",
|
|
325
|
+
type: "string",
|
|
326
|
+
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$"
|
|
327
|
+
},
|
|
328
|
+
targetModel: {
|
|
329
|
+
description: "Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- \"shopping_customers\" for customer relationships\n- \"shopping_channels\" for channel relationships\n- \"bbs_articles\" for article relationships\n- \"attachment_files\" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.",
|
|
330
|
+
type: "string"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
required: [
|
|
334
|
+
"name",
|
|
335
|
+
"targetModel"
|
|
336
|
+
]
|
|
337
|
+
},
|
|
334
338
|
"AutoBePrisma.IPlainField": {
|
|
335
339
|
description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
|
|
336
340
|
type: "object",
|
|
@@ -341,7 +345,7 @@ const claude = {
|
|
|
341
345
|
pattern: "^[a-z][a-z0-9_]*$"
|
|
342
346
|
},
|
|
343
347
|
type: {
|
|
344
|
-
description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n-
|
|
348
|
+
description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n- Datetime: Timestamp fields with date and time",
|
|
345
349
|
oneOf: [
|
|
346
350
|
{
|
|
347
351
|
"const": "string"
|
|
@@ -613,11 +617,11 @@ const claude = {
|
|
|
613
617
|
value: input.description
|
|
614
618
|
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
615
619
|
path: _path + ".relation",
|
|
616
|
-
expected: "
|
|
620
|
+
expected: "AutoBePrisma.IRelation",
|
|
617
621
|
value: input.relation
|
|
618
622
|
})) && _vo5(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
|
|
619
623
|
path: _path + ".relation",
|
|
620
|
-
expected: "
|
|
624
|
+
expected: "AutoBePrisma.IRelation",
|
|
621
625
|
value: input.relation
|
|
622
626
|
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
623
627
|
path: _path + ".unique",
|
|
@@ -882,7 +886,7 @@ const collection = {
|
|
|
882
886
|
]
|
|
883
887
|
},
|
|
884
888
|
"AutoBePrisma.IForeignField": {
|
|
885
|
-
description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.",
|
|
889
|
+
description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.\n\n### Description of {@link relation} property:\n\n> Prisma relation configuration defining the association details.\n> \n> Specifies how this foreign key connects to the target model, including\n> relation name, target model, and target field. This configuration is used\n> to generate the appropriate Prisma relation directive in the schema.",
|
|
886
890
|
type: "object",
|
|
887
891
|
properties: {
|
|
888
892
|
name: {
|
|
@@ -901,22 +905,7 @@ const collection = {
|
|
|
901
905
|
type: "string"
|
|
902
906
|
},
|
|
903
907
|
relation: {
|
|
904
|
-
|
|
905
|
-
type: "object",
|
|
906
|
-
properties: {
|
|
907
|
-
name: {
|
|
908
|
-
description: "Name of the relation property in the Prisma model.\n\nUsed to access the related model instance. Usually a descriptive name\nof the relationship. Examples: \"customer\", \"channel\", \"parent\",\n\"snapshot\"\n\n\n@pattern ^[a-zA-Z_][a-zA-Z0-9_]*$",
|
|
909
|
-
type: "string"
|
|
910
|
-
},
|
|
911
|
-
targetModel: {
|
|
912
|
-
description: "Name of the target model being referenced.\n\nMust match exactly with an existing model name in the schema. Examples:\n\"shopping_customers\", \"shopping_channels\", \"bbs_articles\"",
|
|
913
|
-
type: "string"
|
|
914
|
-
}
|
|
915
|
-
},
|
|
916
|
-
required: [
|
|
917
|
-
"name",
|
|
918
|
-
"targetModel"
|
|
919
|
-
]
|
|
908
|
+
$ref: "#/$defs/AutoBePrisma.IRelation"
|
|
920
909
|
},
|
|
921
910
|
unique: {
|
|
922
911
|
description: "Whether this foreign key has a unique constraint.\n\nTrue: Creates a 1:1 relationship (e.g., user profile, order publish\ndetails) false: Allows 1:N relationship (e.g., customer to multiple\norders) Used for enforcing business rules about relationship\ncardinality.",
|
|
@@ -936,6 +925,24 @@ const collection = {
|
|
|
936
925
|
"nullable"
|
|
937
926
|
]
|
|
938
927
|
},
|
|
928
|
+
"AutoBePrisma.IRelation": {
|
|
929
|
+
description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
|
|
930
|
+
type: "object",
|
|
931
|
+
properties: {
|
|
932
|
+
name: {
|
|
933
|
+
description: "Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- \"customer\" for shopping_customer_id field\n- \"channel\" for shopping_channel_id field\n- \"parent\" for parent_id field in hierarchical structures\n- \"snapshot\" for versioning relationships\n- \"article\" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship's business\nmeaning\n\n\n@pattern ^[a-zA-Z_][a-zA-Z0-9_]*$",
|
|
934
|
+
type: "string"
|
|
935
|
+
},
|
|
936
|
+
targetModel: {
|
|
937
|
+
description: "Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- \"shopping_customers\" for customer relationships\n- \"shopping_channels\" for channel relationships\n- \"bbs_articles\" for article relationships\n- \"attachment_files\" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.",
|
|
938
|
+
type: "string"
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
required: [
|
|
942
|
+
"name",
|
|
943
|
+
"targetModel"
|
|
944
|
+
]
|
|
945
|
+
},
|
|
939
946
|
"AutoBePrisma.IPlainField": {
|
|
940
947
|
description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
|
|
941
948
|
type: "object",
|
|
@@ -945,7 +952,7 @@ const collection = {
|
|
|
945
952
|
type: "string"
|
|
946
953
|
},
|
|
947
954
|
type: {
|
|
948
|
-
description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n-
|
|
955
|
+
description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n- Datetime: Timestamp fields with date and time",
|
|
949
956
|
type: "string",
|
|
950
957
|
"enum": [
|
|
951
958
|
"string",
|
|
@@ -1203,11 +1210,11 @@ const collection = {
|
|
|
1203
1210
|
value: input.description
|
|
1204
1211
|
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
1205
1212
|
path: _path + ".relation",
|
|
1206
|
-
expected: "
|
|
1213
|
+
expected: "AutoBePrisma.IRelation",
|
|
1207
1214
|
value: input.relation
|
|
1208
1215
|
})) && _vo5(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
|
|
1209
1216
|
path: _path + ".relation",
|
|
1210
|
-
expected: "
|
|
1217
|
+
expected: "AutoBePrisma.IRelation",
|
|
1211
1218
|
value: input.relation
|
|
1212
1219
|
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
1213
1220
|
path: _path + ".unique",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaSchema.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,4DAgCC;;;AA7CD,yCAAoE;AAKpE,kDAA0B;AAG1B,uEAAoE;AACpE,iEAA8D;AAC9D,uDAAoD;AACpD,qFAAkF;AAElF,SAAsB,wBAAwB,CAC5C,GAAyB,EACzB,UAAoD;;QAEpD,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,YAAY,GAAa,KAAK,CAAC,IAAI,CACvC,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAC7C,CAAC;QAEF,MAAM,KAAK,GAAW,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,GAAW,CAAC,CAAC;QAClB,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,UAAU,CAAC,GAAG,CAAC,CAAO,CAAC,EAAE,EAAE;;YACzB,MAAM,MAAM,GAA+B,MAAM,IAAA,uBAAU,EAAC,GAAG,EAAE,CAC/D,OAAO,CAAC,GAAG,EAAE;gBACX,QAAQ,EAAE,CAAC,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
|
|
@@ -10,22 +10,22 @@ const transformPrismaSchemaHistories = (analyze, component) => {
|
|
|
10
10
|
type: "systemMessage",
|
|
11
11
|
text: "You are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails through structured function calling.\n\n### Core Principles\n\n- **Never ask for clarification** - Work with the provided requirements and analyze them thoroughly\n- **Output structured function call** - Use AutoBePrisma namespace types for precise schema definition\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails \n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always review and verify no duplicate fields, relations, or models exist\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n\n### Normalization Requirements\n\n#### First Normal Form (1NF)\n- Each field contains atomic values only\n- No repeating groups or arrays in regular tables\n- Each row must be unique\n\n#### Second Normal Form (2NF)\n- Must be in 1NF\n- All non-key attributes fully depend on the entire primary key\n- No partial dependencies on composite keys\n\n#### Third Normal Form (3NF)\n- Must be in 2NF\n- No transitive dependencies\n- All non-key attributes depend only on the primary key\n\n#### Denormalization Rules\n- **ONLY allowed in materialized views** with `mv_` prefix\n- Regular business tables MUST remain fully normalized\n- Pre-calculated totals, counts, summaries \u2192 `mv_` tables only\n- Cached data for performance \u2192 `mv_` tables only\n- Redundant data for reporting \u2192 `mv_` tables only\n\n### Default Working Language: English\n\n- Use the language specified by user in messages as the working language when explicitly provided\n- All thinking and responses must be in the working language\n- All model/field names must be in English regardless of working language\n\n### Input Format\n\nYou will receive:\n1. **User requirements specification** - Detailed business requirements document\n2. **AutoBePrisma types** - Structured interfaces for schema generation\n\n### Task: Generate Structured Prisma Schema Definition\n\nTransform user requirements into a complete AutoBePrisma.IApplication structure that represents the entire Prisma schema system.\n\n### Schema Design Guidelines\n\n#### Naming Conventions\n\n- **Models**: `snake_case` and MUST be plural (e.g., `user_profiles`, `order_items`, `shopping_customers`)\n- **Fields**: `snake_case` (e.g., `created_at`, `user_id`, `shopping_customer_id`) \n- **Relations**: `snake_case` (e.g., `customer`, `order_items`, `user_profile`)\n- **Foreign Keys**: `{target_model_name}_id` pattern (e.g., `shopping_customer_id`, `bbs_article_id`)\n- **Materialized Views**: `mv_` prefix (e.g., `mv_shopping_sale_last_snapshots`)\n\n#### File Organization Principles\n\n- Organize by business domains (8-10 files typical)\n- Follow dependency order in numbering: `schema-{number}-{domain}.prisma`\n- Common domains: Systematic, Actors, Sales, Carts, Orders, Coupons, Coins, Inquiries, Favorites, Articles\n- Each file should contain 3-15 related models\n\n#### Data Type Mapping\n\n- **Primary Keys**: Always `\"uuid\"` type\n- **Foreign Keys**: Always `\"uuid\"` type \n- **Timestamps**: Use `\"datetime\"` type\n- **Monetary Values**: Use `\"double\"` type\n- **Quantities/Counts**: Use `\"int\"` type\n- **Text Content**: Use `\"string\"` type\n- **URLs/Links**: Use `\"uri\"` type\n- **Flags/Booleans**: Use `\"boolean\"` type\n- **Dates Only**: Use `\"date\"` type (rare)\n\n#### Prohibited Field Types in Regular Tables\n\n**NEVER include these in regular business tables:**\n- Pre-calculated totals (e.g., `total_amount`, `item_count`)\n- Cached values (e.g., `last_purchase_date`, `total_spent`)\n- Aggregated data (e.g., `average_rating`, `review_count`)\n- Derived values (e.g., `full_name` from first/last name)\n- Summary fields (e.g., `order_summary`, `customer_status`)\n\n**These belong ONLY in `mv_` materialized views!**\n\n#### Description Writing Standards\n\nEach description MUST include:\n\n1. **Requirements Mapping**: Which specific requirement from the requirements analysis this implements\n2. **Business Purpose**: What business problem this solves in simple, understandable language\n3. **Technical Context**: How it relates to other models and system architecture\n4. **Normalization Compliance**: How this maintains normalized structure\n5. **Usage Examples**: Clear examples of how this will be used\n6. **Behavioral Notes**: Important constraints, rules, or special behaviors\n\n**Model Description Format:**\n```\n\"[Model Purpose] - This implements the [specific requirement] from the requirements document. \n\n[Business explanation in simple terms]. Maintains [normalization level] compliance by [explanation]. For example, [concrete usage example].\n\nKey relationships: [important connections to other models].\nSpecial behaviors: [any important constraints or rules].\"\n```\n\n**Field Description Format:**\n```\n\"[Field purpose] - Implements the [requirement aspect]. \n\n[Business meaning]. Ensures normalization by [explanation]. For example, [usage example].\n[Any constraints or special behaviors].\"\n```\n\n#### Relationship Design Patterns\n\n- **1:1 Relationships**: Set `unique: true` on foreign key\n- **1:N Relationships**: Set `unique: false` on foreign key \n- **M:N Relationships**: Create junction tables with composite keys\n- **Self-References**: Use `parent_id` field name\n- **Snapshot Relationships**: Link current entity to its snapshot history\n- **Optional Relationships**: Set `nullable: true` when relationship is optional\n\n#### Index Strategy\n\n- **NO single foreign key indexes** - Prisma auto-creates these\n- **Composite indexes OK** - Include foreign keys with other fields for query patterns\n- **Unique indexes**: For business constraints (emails, codes, composite keys)\n- **Performance indexes**: For common query patterns (timestamps, search fields)\n- **GIN indexes**: For full-text search on string fields\n\n#### Materialized View Patterns\n\n- Set `material: true` for computed/cached tables\n- Prefix names with `mv_`\n- Common patterns: `mv_*_last_snapshots`, `mv_*_prices`, `mv_*_balances`, `mv_*_inventories`\n- **ONLY place for denormalized data**\n- **ONLY place for pre-calculated fields**\n- **ONLY place for aggregated values**\n\n### Requirements Analysis Process\n\n#### 1. Domain Identification\n- Identify major business domains from requirements\n- Group related functionality into coherent domains\n- Determine file organization and dependencies\n\n#### 2. Entity Extraction\n- Extract all business entities mentioned in requirements\n- Identify main entities vs snapshot entities vs junction tables\n- Determine materialized views needed for performance\n- **Separate normalized entities from denormalized reporting needs**\n\n#### 3. Relationship Mapping\n- Map all relationships between entities\n- Identify cardinality (1:1, 1:N, M:N)\n- Determine optional vs required relationships\n- **Ensure relationships maintain normalization**\n\n#### 4. Attribute Analysis\n- Extract all data attributes from requirements\n- Determine data types and constraints\n- Identify nullable vs required fields\n- **Separate atomic data from calculated data**\n\n#### 5. Business Rule Implementation\n- Identify unique constraints from business rules\n- Determine audit trail requirements (snapshot pattern)\n- Map performance requirements to indexes\n- **Map denormalization needs to materialized views**\n\n### MANDATORY REVIEW PROCESS\n\n#### Pre-Output Validation Checklist\n\n**ALWAYS perform this comprehensive review before generating the function call:**\n\n1. **Normalization Validation**\n - All regular tables comply with 3NF minimum\n - No calculated fields in regular business tables\n - All denormalized data is in `mv_` tables only\n - No transitive dependencies in regular tables\n\n2. **Model Validation**\n - All model names are plural and unique across all files\n - All models have exactly one primary key field named \"id\" of type \"uuid\"\n - All materialized views have `material: true` and \"mv_\" prefix\n - Regular tables contain only atomic, normalized data\n\n3. **Field Validation** \n - No duplicate field names within any model\n - All foreign key fields follow `{target_model}_id` pattern\n - All foreign key fields have type \"uuid\"\n - All field descriptions map to specific requirements\n - **NO calculated fields in regular tables**\n\n4. **Relationship Validation**\n - All foreign fields have corresponding relation definitions\n - Target models exist in the schema structure\n - No duplicate relation names within any model\n - Cardinality correctly reflected in `unique` property\n\n5. **Index Validation**\n - No single foreign key indexes in plain or unique indexes\n - All composite indexes serve clear query patterns\n - All referenced field names exist in their models\n - GIN indexes only on string type fields\n\n6. **Cross-File Validation**\n - All referenced models exist in appropriate files\n - File dependencies are properly ordered\n - No circular dependencies between files\n\n#### Quality Assurance Questions\n\nBefore finalizing, verify:\n- Does each model clearly implement a specific business requirement?\n- Are all relationships bidirectionally consistent?\n- Do all descriptions provide clear requirement traceability?\n- Are naming conventions consistently applied?\n- Is the snapshot architecture properly implemented?\n- Are all business constraints captured in unique indexes?\n- **Is every regular table properly normalized?**\n- **Are ALL calculated/aggregated fields in `mv_` tables only?**\n\n### Expected Output\n\nGenerate a single function call using the AutoBePrisma.IApplication structure:\n\n```typescript\n// Function call format\nconst application: AutoBePrisma.IApplication = {\n files: [\n {\n filename: \"schema-01-articles.prisma\",\n namespace: \"Articles\", \n models: [...]\n },\n // ... more files\n ]\n};\n```\n\n### Final Quality Checklist\n\nBefore outputting, ensure:\n- [ ] All models implement specific requirements with clear traceability\n- [ ] All field descriptions explain business purpose and requirement mapping\n- [ ] All model names are plural and follow naming conventions\n- [ ] **NO duplicate fields within any model**\n- [ ] **NO duplicate relations within any model** \n- [ ] **NO duplicate model names across all files**\n- [ ] All foreign keys have proper relations defined\n- [ ] No single foreign key indexes in index arrays\n- [ ] All cross-file references are valid\n- [ ] Snapshot architecture properly implemented where needed\n- [ ] **ALL REGULAR TABLES FULLY NORMALIZED (3NF minimum)**\n- [ ] **NO PRE-CALCULATED FIELDS IN REGULAR TABLES**\n- [ ] **ALL DENORMALIZATION IN `mv_` TABLES ONLY**\n- [ ] **COMPREHENSIVE VALIDATION COMPLETED**" /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
12
12
|
},
|
|
13
|
+
// {
|
|
14
|
+
// id: v4(),
|
|
15
|
+
// created_at: new Date().toISOString(),
|
|
16
|
+
// type: "systemMessage",
|
|
17
|
+
// text: [
|
|
18
|
+
// "Before making prisma schema files,",
|
|
19
|
+
// "learn about the prisma schema language",
|
|
20
|
+
// "from the best practices and examples",
|
|
21
|
+
// "",
|
|
22
|
+
// AutoBeSystemPromptConstant.PRISMA_EXAMPLE,
|
|
23
|
+
// ].join("\n"),
|
|
24
|
+
// },
|
|
13
25
|
{
|
|
14
26
|
id: (0, uuid_1.v4)(),
|
|
15
27
|
created_at: new Date().toISOString(),
|
|
16
28
|
type: "systemMessage",
|
|
17
|
-
text: [
|
|
18
|
-
"Before making prisma schema files,",
|
|
19
|
-
"learn about the prisma schema language",
|
|
20
|
-
"from the best practices and examples",
|
|
21
|
-
"",
|
|
22
|
-
"Study the following comprehensive BBS (bullet-in board system) project schema as a reference for implementing all the patterns and best practices outlined above. \n\nThis enterprise-level implementation demonstrates proper domain organization, relationship modeling, documentation standards, and advanced patterns like snapshots, inheritance, and materialized views.\n\n## Input (Requirement Analysis)\n\n```json\n{% EXAMPLE_BBS_REQUIREMENT_ANALYSIS %}\n```\n\nWhen such requirement analysis report comes\n\n## Output (Prisma Schema Files)\n\n```json\n{\"main.prisma\":\"datasource db {\\n provider = \\\"postgresql\\\"\\n url = env(\\\"BBS_POSTGRES_URL\\\")\\n}\\n\\ngenerator client {\\n provider = \\\"prisma-client-js\\\"\\n previewFeatures = [\\\"views\\\"]\\n binaryTargets = [\\\"native\\\"]\\n}\\n\\ngenerator markdown {\\n provider = \\\"prisma-markdown\\\"\\n title = \\\"Bullet-in Board System\\\"\\n output = \\\"../../docs/ERD.md\\\"\\n}\\n\\n//-----------------------------------------------------------\\n// ARTICLES\\n//-----------------------------------------------------------\\n/// Attachment File.\\n///\\n/// Every attachment files that are managed in current system.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel attachment_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// File name, except extension.\\n name String @db.VarChar\\n\\n /// Extension.\\n ///\\n /// Possible to omit like `README` case.\\n extension String? @db.VarChar\\n\\n /// URL path of the real file.\\n url String @db.VarChar\\n\\n /// Creation time of file.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n bbs_article_snapshot_files bbs_article_snapshot_files[]\\n bbs_article_comment_snapshots_files bbs_article_comment_snapshot_files[]\\n}\\n\\n/// Article entity.\\n/// \\n/// `bbs_articles` is a super-type entity of all kinds of articles in the \\n/// current backend system, literally shaping individual articles of \\n/// the bulletin board.\\n///\\n/// And, as you can see, the elements that must inevitably exist in the \\n/// article, such as the title or the body, do not exist in the `bbs_articles`, \\n/// but exist in the subsidiary entity, {@link bbs_article_snapshots}, as a \\n/// 1: N relationship, which is because a new snapshot record is published \\n/// every time the article is modified.\\n///\\n/// The reason why a new snapshot record is published every time the article \\n/// is modified is to preserve the evidence. Due to the nature of e-community, \\n/// there is always a threat of dispute among the participants. And it can \\n/// happen that disputes arise through articles or comments, and to prevent \\n/// such things as modifying existing articles to manipulate the situation, \\n/// the article is designed in this structure.\\n///\\n/// In other words, to keep evidence, and prevent fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_articles {\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Writer's name.\\n writer String @db.VarChar\\n\\n /// Password for modification.\\n password String @db.VarChar\\n\\n /// Creation time of article.\\n created_at DateTime @db.Timestamptz\\n\\n /// Deletion time of article.\\n ///\\n /// To keep evidence, do not delete the article, but just mark it as \\n /// deleted.\\n deleted_at DateTime? @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// List of snapshots.\\n ///\\n /// It is created for the first time when an article is created, and is\\n /// accumulated every time the article is modified.\\n snapshots bbs_article_snapshots[]\\n\\n /// List of comments.\\n comments bbs_article_comments[]\\n\\n mv_last mv_bbs_article_last_snapshots?\\n\\n @@index([created_at])\\n}\\n\\n/// Snapshot of article.\\n///\\n/// `bbs_article_snapshots` is a snapshot entity that contains the contents of\\n/// the article, as mentioned in {@link bbs_articles}, the contents of the \\n/// article are separated from the article record to keep evidence and prevent \\n/// fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_snapshots {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belong article's {@link bbs_articles.id}\\n bbs_article_id String @db.Uuid\\n\\n /// Format of body.\\n ///\\n /// Same meaning with extension like `html`, `md`, `txt`.\\n format String @db.VarChar\\n\\n /// Title of article.\\n title String @db.VarChar\\n\\n /// Content body of article.\\n body String\\n\\n /// IP address of the snapshot writer.\\n ip String @db.VarChar\\n\\n /// Creation time of record.\\n ///\\n /// It means creation time or update time or article.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belong article info.\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n\\n /// List of wrappers of attachment files.\\n to_files bbs_article_snapshot_files[]\\n\\n mv_last mv_bbs_article_last_snapshots?\\n\\n @@index([bbs_article_id, created_at])\\n}\\n\\n/// Attachment file of article snapshot.\\n///\\n/// `bbs_article_snapshot_files` is an entity that shapes the attached files of\\n/// the article snapshot.\\n///\\n/// `bbs_article_snapshot_files` is a typical pair relationship table to \\n/// resolve the M: N relationship between {@link bbs_article_snapshots} and\\n/// {@link attachment_files} tables. Also, to ensure the order of the attached\\n/// files, it has an additional `sequence` attribute, which we will continue to\\n/// see in this documents.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_snapshot_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged snapshot's {@link bbs_article_snapshots.id}\\n bbs_article_snapshot_id String @db.Uuid\\n\\n /// Belonged file's {@link attachment_files.id}\\n attachment_file_id String @db.Uuid\\n\\n /// Sequence of attachment file in the snapshot.\\n sequence Int @db.Integer\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n snapshot bbs_article_snapshots @relation(fields: [bbs_article_snapshot_id], references: [id], onDelete: Cascade)\\n\\n /// Belonged file.\\n file attachment_files @relation(fields: [attachment_file_id], references: [id], onDelete: Cascade)\\n\\n @@index([bbs_article_snapshot_id])\\n @@index([attachment_file_id])\\n}\\n\\n/// Comment written on an article.\\n///\\n/// `bbs_article_comments` is an entity that shapes the comments written on an\\n/// article.\\n///\\n/// And for this comment, as in the previous relationship between \\n/// {@link bbs_articles} and {@link bbs_article_snapshots}, the content body \\n/// of the comment is stored in the sub {@link bbs_article_comment_snapshots} \\n/// table for evidentialism, and a new snapshot record is issued every time \\n/// the comment is modified.\\n///\\n/// Also, `bbs_article_comments` is expressing the relationship of the \\n/// hierarchical reply structure through the `parent_id` attribute.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comments {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged article's {@link bbs_articles.id}\\n bbs_article_id String @db.Uuid\\n\\n /// Parent comment's {@link bbs_article_comments.id}\\n ///\\n /// Used to express the hierarchical reply structure.\\n parent_id String? @db.Uuid\\n\\n /// Writer's name.\\n writer String @db.VarChar\\n\\n /// Password for modification.\\n password String @db.VarChar\\n\\n /// Creation time of comment.\\n created_at DateTime @db.Timestamptz\\n\\n /// Deletion time of comment.\\n ///\\n /// Do not allow to delete the comment, but just mark it as deleted, \\n /// to keep evidence.\\n deleted_at DateTime? @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n\\n /// Parent comment.\\n ///\\n /// Only when reply case.\\n parent bbs_article_comments? @relation(\\\"bbs_article_comments_reply\\\", fields: [parent_id], references: [id], onDelete: Cascade)\\n\\n /// List of children comments.\\n ///\\n /// Reply comments of current.\\n children bbs_article_comments[] @relation(\\\"bbs_article_comments_reply\\\")\\n\\n /// List of snapshots.\\n ///\\n /// It is created for the first time when a comment is created, and is\\n /// accumulated every time the comment is modified.\\n snapshots bbs_article_comment_snapshots[]\\n\\n @@index([bbs_article_id, parent_id, created_at])\\n}\\n\\n/// Snapshot of comment.\\n///\\n/// `bbs_article_comment_snapshots` is a snapshot entity that contains the \\n/// contents of the comment.\\n///\\n/// As mentioned in {@link bbs_article_comments}, designed to keep evidence \\n/// and prevent fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comment_snapshots {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged article's {@link bbs_article_comments.id}\\n bbs_article_comment_id String @db.Uuid\\n\\n /// Format of content body.\\n ///\\n /// Same meaning with extension like `html`, `md`, `txt`.\\n format String @db.VarChar\\n\\n /// Content body of comment.\\n body String\\n\\n /// IP address of the snapshot writer.\\n ip String @db.VarChar\\n\\n /// Creation time of record.\\n ///\\n /// It means creation time or update time or comment.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belong comment info.\\n comment bbs_article_comments @relation(fields: [bbs_article_comment_id], references: [id], onDelete: Cascade)\\n\\n /// List of wrappers of attachment files.\\n to_files bbs_article_comment_snapshot_files[]\\n\\n @@index([bbs_article_comment_id, created_at])\\n}\\n\\n/// Attachment file of comment snapshot.\\n/// \\n/// `bbs_article_comment_snapshot_files` is an entity resolving the M:N \\n/// relationship between {@link bbs_article_comment_snapshots} and \\n/// {@link attachment_files} tables.\\n/// \\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comment_snapshot_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged snapshot's {@link bbs_article_comment_snapshots.id}\\n bbs_article_comment_snapshot_id String @db.Uuid\\n\\n /// Belonged file's {@link attachment_files.id}\\n attachment_file_id String @db.Uuid\\n\\n /// Sequence order.\\n ///\\n /// Sequence order of the attached file in the belonged snapshot.\\n sequence Int @db.Integer\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n snapshot bbs_article_comment_snapshots @relation(fields: [bbs_article_comment_snapshot_id], references: [id], onDelete: Cascade)\\n\\n /// Belonged file.\\n file attachment_files @relation(fields: [attachment_file_id], references: [id], onDelete: Cascade)\\n\\n @@index([bbs_article_comment_snapshot_id])\\n @@index([attachment_file_id])\\n}\\n\\n/// @hidden\\n/// @author Samchon\\nmodel mv_bbs_article_last_snapshots {\\n bbs_article_id String @id @db.Uuid\\n bbs_article_snapshot_id String @db.Uuid\\n\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n snapshot bbs_article_snapshots @relation(fields: [bbs_article_snapshot_id], references: [id], onDelete: Cascade)\\n\\n @@unique([bbs_article_snapshot_id])\\n}\\n\"}\n```\n\nYou have to make above like prisma schema files.\n\nStudy the above schema files, and follow its coding style." /* AutoBeSystemPromptConstant.PRISMA_EXAMPLE */,
|
|
23
|
-
].join("\n"),
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: (0, uuid_1.v4)(),
|
|
27
|
-
created_at: new Date().toISOString(),
|
|
28
|
-
type: "assistantMessage",
|
|
29
29
|
text: [
|
|
30
30
|
"Here is the requirement analysis report.",
|
|
31
31
|
"",
|
|
@@ -48,14 +48,6 @@ const transformPrismaSchemaHistories = (analyze, component) => {
|
|
|
48
48
|
...component.tables.map((table) => ` - ${table}`),
|
|
49
49
|
` - Entire tables you can reference:`,
|
|
50
50
|
...component.entireTables.map((table) => ` - ${table}`),
|
|
51
|
-
"",
|
|
52
|
-
"## User Role Rules",
|
|
53
|
-
"",
|
|
54
|
-
"**CRITICAL**: For User Role tables (User, Admin, Moderator, etc.):",
|
|
55
|
-
"1. **Separate tables** - Each role = independent table (User, Admin, Moderator tables)",
|
|
56
|
-
"2. **No `role` field** - Never include role enum fields in any table",
|
|
57
|
-
"",
|
|
58
|
-
"You can use TPT (Table Per Type) pattern with FK relationships if needed, or completely separate tables.",
|
|
59
51
|
].join("\n"),
|
|
60
52
|
},
|
|
61
53
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAEA,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAC5C,OAA6B,EAC7B,SAIC,EAGD,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,8oWAA0C;SAC/C;QACD;
|
|
1
|
+
{"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../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kCA0DzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autobe/agent",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "AI backend server code generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Wrtn Technologies",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@agentica/core": "^0.30.
|
|
23
|
+
"@agentica/core": "^0.30.3",
|
|
24
24
|
"@prisma/internals": "^6.7.0",
|
|
25
25
|
"@samchon/openapi": "^4.5.0",
|
|
26
26
|
"openai": "^5.2.0",
|
|
27
27
|
"tstl": "^3.0.0",
|
|
28
28
|
"typia": "^9.5.0",
|
|
29
29
|
"uuid": "^11.1.0",
|
|
30
|
-
"@autobe/
|
|
31
|
-
"@autobe/
|
|
30
|
+
"@autobe/interface": "^0.10.3",
|
|
31
|
+
"@autobe/utils": "^0.10.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"ts-node": "^10.9.2",
|
|
41
41
|
"ts-patch": "^3.3.0",
|
|
42
42
|
"typescript": "~5.8.3",
|
|
43
|
-
"@autobe/
|
|
44
|
-
"@autobe/
|
|
43
|
+
"@autobe/filesystem": "^0.10.3",
|
|
44
|
+
"@autobe/compiler": "^0.10.3"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
|
47
47
|
"ai",
|
|
@@ -83,11 +83,11 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
83
83
|
],
|
|
84
84
|
});
|
|
85
85
|
enforceToolCall(agentica);
|
|
86
|
+
|
|
86
87
|
await agentica.conversate("Make prisma schema file please").finally(() => {
|
|
87
88
|
const tokenUsage = agentica.getTokenUsage();
|
|
88
89
|
ctx.usage().record(tokenUsage, ["prisma"]);
|
|
89
90
|
});
|
|
90
|
-
|
|
91
91
|
if (pointer.value === null)
|
|
92
92
|
throw new Error("Unreachable code: Prisma Schema not generated");
|
|
93
93
|
return pointer.value;
|
|
@@ -21,22 +21,22 @@ export const transformPrismaSchemaHistories = (
|
|
|
21
21
|
type: "systemMessage",
|
|
22
22
|
text: AutoBeSystemPromptConstant.PRISMA_SCHEMA,
|
|
23
23
|
},
|
|
24
|
+
// {
|
|
25
|
+
// id: v4(),
|
|
26
|
+
// created_at: new Date().toISOString(),
|
|
27
|
+
// type: "systemMessage",
|
|
28
|
+
// text: [
|
|
29
|
+
// "Before making prisma schema files,",
|
|
30
|
+
// "learn about the prisma schema language",
|
|
31
|
+
// "from the best practices and examples",
|
|
32
|
+
// "",
|
|
33
|
+
// AutoBeSystemPromptConstant.PRISMA_EXAMPLE,
|
|
34
|
+
// ].join("\n"),
|
|
35
|
+
// },
|
|
24
36
|
{
|
|
25
37
|
id: v4(),
|
|
26
38
|
created_at: new Date().toISOString(),
|
|
27
39
|
type: "systemMessage",
|
|
28
|
-
text: [
|
|
29
|
-
"Before making prisma schema files,",
|
|
30
|
-
"learn about the prisma schema language",
|
|
31
|
-
"from the best practices and examples",
|
|
32
|
-
"",
|
|
33
|
-
AutoBeSystemPromptConstant.PRISMA_EXAMPLE,
|
|
34
|
-
].join("\n"),
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: v4(),
|
|
38
|
-
created_at: new Date().toISOString(),
|
|
39
|
-
type: "assistantMessage",
|
|
40
40
|
text: [
|
|
41
41
|
"Here is the requirement analysis report.",
|
|
42
42
|
"",
|
|
@@ -59,14 +59,6 @@ export const transformPrismaSchemaHistories = (
|
|
|
59
59
|
...component.tables.map((table) => ` - ${table}`),
|
|
60
60
|
` - Entire tables you can reference:`,
|
|
61
61
|
...component.entireTables.map((table) => ` - ${table}`),
|
|
62
|
-
"",
|
|
63
|
-
"## User Role Rules",
|
|
64
|
-
"",
|
|
65
|
-
"**CRITICAL**: For User Role tables (User, Admin, Moderator, etc.):",
|
|
66
|
-
"1. **Separate tables** - Each role = independent table (User, Admin, Moderator tables)",
|
|
67
|
-
"2. **No `role` field** - Never include role enum fields in any table",
|
|
68
|
-
"",
|
|
69
|
-
"You can use TPT (Table Per Type) pattern with FK relationships if needed, or completely separate tables.",
|
|
70
62
|
].join("\n"),
|
|
71
63
|
},
|
|
72
64
|
];
|