File size: 17,446 Bytes
e0a827b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
[
  {
    "table": "customers",
    "description": "People or organizations that purchase or may purchase goods/services.",
    "columns": [
      {"name": "customer_id", "type": "BIGINT", "description": "Surrogate primary key for the customer."},
      {"name": "account_type", "type": "VARCHAR(20)", "description": "Type such as consumer or business."},
      {"name": "first_name", "type": "VARCHAR(80)", "description": "Given name for contact purposes."},
      {"name": "last_name", "type": "VARCHAR(80)", "description": "Family name for contact purposes."},
      {"name": "email", "type": "VARCHAR(255)", "description": "Primary contact email; unique when present."},
      {"name": "phone", "type": "VARCHAR(32)", "description": "Primary contact phone number."},
      {"name": "address_id", "type": "BIGINT", "description": "FK to customer_addresses for canonical address."},
      {"name": "country", "type": "CHAR(2)", "description": "ISO‑2 country code of primary address."},
      {"name": "registered_at", "type": "TIMESTAMP", "description": "Timestamp when the customer registered."},
      {"name": "status", "type": "VARCHAR(20)", "description": "Lifecycle state such as active, prospect, churned."}
    ]
  },
  {
    "table": "customer_addresses",
    "description": "Normalized postal addresses for customers, suppliers, and locations.",
    "columns": [
      {"name": "address_id", "type": "BIGINT", "description": "Primary key for the address record."},
      {"name": "line1", "type": "VARCHAR(120)", "description": "Street line 1."},
      {"name": "line2", "type": "VARCHAR(120)", "description": "Street line 2 or unit/suite (nullable)."},
      {"name": "city", "type": "VARCHAR(80)", "description": "City or locality."},
      {"name": "state", "type": "VARCHAR(80)", "description": "Region/state/province."},
      {"name": "postal_code", "type": "VARCHAR(20)", "description": "Postal/ZIP code."},
      {"name": "country", "type": "CHAR(2)", "description": "ISO‑2 country code."},
      {"name": "latitude", "type": "DECIMAL(9,6)", "description": "Latitude for geocoding (nullable)."},
      {"name": "longitude", "type": "DECIMAL(9,6)", "description": "Longitude for geocoding (nullable)."},
      {"name": "valid_from", "type": "DATE", "description": "Start date the address is valid from."},
      {"name": "valid_to", "type": "DATE", "description": "End date the address is valid to (nullable)."}
    ]
  },
  {
    "table": "products",
    "description": "Catalog of sellable items or services.",
    "columns": [
      {"name": "product_id", "type": "BIGINT", "description": "Primary key for the product."},
      {"name": "sku", "type": "VARCHAR(64)", "description": "Stock keeping unit code; unique per product."},
      {"name": "product_name", "type": "VARCHAR(160)", "description": "Marketing name of the product."},
      {"name": "category_id", "type": "BIGINT", "description": "FK to categories for hierarchy grouping."},
      {"name": "unit_price", "type": "DECIMAL(12,2)", "description": "List price in the default currency."},
      {"name": "currency", "type": "CHAR(3)", "description": "ISO‑4217 currency code for unit_price."},
      {"name": "active", "type": "BOOLEAN", "description": "If the product is available for sale."},
      {"name": "created_at", "type": "TIMESTAMP", "description": "Record creation time."},
      {"name": "updated_at", "type": "TIMESTAMP", "description": "Last update time."}
    ]
  },
  {
    "table": "categories",
    "description": "Product category hierarchy for analytics and navigation.",
    "columns": [
      {"name": "category_id", "type": "BIGINT", "description": "Primary key for the category."},
      {"name": "category_name", "type": "VARCHAR(120)", "description": "Human‑readable category label."},
      {"name": "parent_category_id", "type": "BIGINT", "description": "Self‑reference to parent category (nullable)."},
      {"name": "description", "type": "TEXT", "description": "Longer description for the category (nullable)."}
    ]
  },
  {
    "table": "orders",
    "description": "Sales orders placed by customers; header level details.",
    "columns": [
      {"name": "order_id", "type": "BIGINT", "description": "Primary key for the order."},
      {"name": "customer_id", "type": "BIGINT", "description": "FK to customers who placed the order."},
      {"name": "order_date", "type": "TIMESTAMP", "description": "Time the order was submitted."},
      {"name": "status", "type": "VARCHAR(20)", "description": "Order state such as pending, paid, shipped."},
      {"name": "payment_method", "type": "VARCHAR(20)", "description": "Method like card, bank, wallet."},
      {"name": "order_total", "type": "DECIMAL(12,2)", "description": "Total monetary value of the order."},
      {"name": "currency", "type": "CHAR(3)", "description": "Currency for order_total."},
      {"name": "shipping_address_id", "type": "BIGINT", "description": "FK to customer_addresses for shipping."}
    ]
  },
  {
    "table": "order_items",
    "description": "Line‑level items linking orders to products.",
    "columns": [
      {"name": "order_item_id", "type": "BIGINT", "description": "Primary key for the line item."},
      {"name": "order_id", "type": "BIGINT", "description": "FK to orders header."},
      {"name": "product_id", "type": "BIGINT", "description": "FK to products catalog."},
      {"name": "quantity", "type": "INT", "description": "Units ordered for this product."},
      {"name": "unit_price", "type": "DECIMAL(12,2)", "description": "Unit price at time of sale."},
      {"name": "discount", "type": "DECIMAL(5,2)", "description": "Percentage discount applied (0–100)."},
      {"name": "line_total", "type": "DECIMAL(12,2)", "description": "Extended price after discount."}
    ]
  },
  {
    "table": "payments",
    "description": "Customer payments applied to orders or invoices.",
    "columns": [
      {"name": "payment_id", "type": "BIGINT", "description": "Primary key for the payment."},
      {"name": "order_id", "type": "BIGINT", "description": "FK to orders being paid (nullable if invoice_id used)."},
      {"name": "invoice_id", "type": "BIGINT", "description": "FK to invoices (nullable if order_id used)."},
      {"name": "payment_date", "type": "TIMESTAMP", "description": "Time the payment was captured."},
      {"name": "amount", "type": "DECIMAL(12,2)", "description": "Amount received in payment."},
      {"name": "currency", "type": "CHAR(3)", "description": "Currency for the amount."},
      {"name": "method", "type": "VARCHAR(20)", "description": "Card, bank_transfer, wallet, cash, etc."},
      {"name": "status", "type": "VARCHAR(20)", "description": "authorized, captured, refunded, failed."}
    ]
  },
  {
    "table": "invoices",
    "description": "Billing documents issued to customers for accounting.",
    "columns": [
      {"name": "invoice_id", "type": "BIGINT", "description": "Primary key for the invoice."},
      {"name": "customer_id", "type": "BIGINT", "description": "FK to customers billed."},
      {"name": "invoice_date", "type": "DATE", "description": "Date the invoice was issued."},
      {"name": "due_date", "type": "DATE", "description": "Payment due date per terms."},
      {"name": "total_due", "type": "DECIMAL(12,2)", "description": "Total amount due on the invoice."},
      {"name": "currency", "type": "CHAR(3)", "description": "Currency for total_due."},
      {"name": "status", "type": "VARCHAR(20)", "description": "open, paid, overdue, cancelled."}
    ]
  },
  {
    "table": "subscriptions",
    "description": "Recurring customer subscriptions for SaaS or services.",
    "columns": [
      {"name": "subscription_id", "type": "BIGINT", "description": "Primary key for the subscription."},
      {"name": "customer_id", "type": "BIGINT", "description": "FK to customers holding the subscription."},
      {"name": "plan_id", "type": "BIGINT", "description": "FK to subscription_plans."},
      {"name": "start_date", "type": "DATE", "description": "Start date of the subscription."},
      {"name": "end_date", "type": "DATE", "description": "End date or null if ongoing."},
      {"name": "status", "type": "VARCHAR(20)", "description": "active, paused, cancelled, expired."},
      {"name": "auto_renew", "type": "BOOLEAN", "description": "Whether the subscription auto‑renews."}
    ]
  },
  {
    "table": "subscription_plans",
    "description": "Catalog of subscription plans and pricing tiers.",
    "columns": [
      {"name": "plan_id", "type": "BIGINT", "description": "Primary key for the plan."},
      {"name": "plan_name", "type": "VARCHAR(80)", "description": "Marketing name for the plan."},
      {"name": "billing_cycle", "type": "VARCHAR(20)", "description": "monthly, yearly, etc."},
      {"name": "price", "type": "DECIMAL(12,2)", "description": "Price per billing cycle."},
      {"name": "currency", "type": "CHAR(3)", "description": "Currency for price."},
      {"name": "features", "type": "JSON", "description": "Feature flags or limits for the plan."}
    ]
  },
  {
    "table": "employees",
    "description": "Company staff directory for HR and RBAC.",
    "columns": [
      {"name": "employee_id", "type": "BIGINT", "description": "Primary key for employee."},
      {"name": "first_name", "type": "VARCHAR(80)", "description": "Given name."},
      {"name": "last_name", "type": "VARCHAR(80)", "description": "Family name."},
      {"name": "email", "type": "VARCHAR(255)", "description": "Work email address (unique)."},
      {"name": "phone", "type": "VARCHAR(32)", "description": "Work phone number."},
      {"name": "hire_date", "type": "DATE", "description": "Date employee joined."},
      {"name": "job_title", "type": "VARCHAR(120)", "description": "Official job title."},
      {"name": "department_id", "type": "BIGINT", "description": "FK to departments."},
      {"name": "manager_id", "type": "BIGINT", "description": "Self‑FK to the manager employee_id (nullable)."}
    ]
  },
  {
    "table": "departments",
    "description": "Organizational units for budgeting and reporting.",
    "columns": [
      {"name": "department_id", "type": "BIGINT", "description": "Primary key for the department."},
      {"name": "department_name", "type": "VARCHAR(120)", "description": "Name of the department."},
      {"name": "cost_center", "type": "VARCHAR(32)", "description": "Accounting cost center code."},
      {"name": "manager_id", "type": "BIGINT", "description": "FK to employees who manage the department."}
    ]
  },
  {
    "table": "projects",
    "description": "Portfolio of internal or client projects with budgets and timelines.",
    "columns": [
      {"name": "project_id", "type": "BIGINT", "description": "Primary key for the project."},
      {"name": "project_name", "type": "VARCHAR(160)", "description": "Short name of the project."},
      {"name": "sponsor_department_id", "type": "BIGINT", "description": "FK to departments sponsoring the work."},
      {"name": "start_date", "type": "DATE", "description": "Planned or actual start date."},
      {"name": "end_date", "type": "DATE", "description": "Planned or actual end date (nullable)."},
      {"name": "budget", "type": "DECIMAL(14,2)", "description": "Approved budget for the project."},
      {"name": "status", "type": "VARCHAR(20)", "description": "planned, active, on_hold, complete."}
    ]
  },
  {
    "table": "tasks",
    "description": "Executable work items under projects.",
    "columns": [
      {"name": "task_id", "type": "BIGINT", "description": "Primary key for the task."},
      {"name": "project_id", "type": "BIGINT", "description": "FK to projects."},
      {"name": "task_name", "type": "VARCHAR(160)", "description": "Short description of the task."},
      {"name": "assignee_employee_id", "type": "BIGINT", "description": "FK to employees assigned."},
      {"name": "due_date", "type": "DATE", "description": "Target completion date."},
      {"name": "status", "type": "VARCHAR(20)", "description": "todo, in_progress, blocked, done."},
      {"name": "priority", "type": "VARCHAR(10)", "description": "low, medium, high, urgent."}
    ]
  },
  {
    "table": "support_tickets",
    "description": "Customer support issues tracked by the service team.",
    "columns": [
      {"name": "ticket_id", "type": "BIGINT", "description": "Primary key for the ticket."},
      {"name": "customer_id", "type": "BIGINT", "description": "FK to customers who opened the ticket."},
      {"name": "subject", "type": "VARCHAR(160)", "description": "Short title summarizing the issue."},
      {"name": "description", "type": "TEXT", "description": "Detailed problem description."},
      {"name": "priority", "type": "VARCHAR(10)", "description": "low, medium, high, urgent."},
      {"name": "status", "type": "VARCHAR(20)", "description": "open, pending, on_hold, resolved, closed."},
      {"name": "opened_at", "type": "TIMESTAMP", "description": "When the ticket was created."},
      {"name": "closed_at", "type": "TIMESTAMP", "description": "When the ticket was closed (nullable)."}
    ]
  },
  {
    "table": "web_sessions",
    "description": "Website/app sessions for digital analytics.",
    "columns": [
      {"name": "session_id", "type": "VARCHAR(64)", "description": "Client session identifier."},
      {"name": "visitor_id", "type": "VARCHAR(64)", "description": "Anonymous or known user identifier."},
      {"name": "started_at", "type": "TIMESTAMP", "description": "Session start time."},
      {"name": "ended_at", "type": "TIMESTAMP", "description": "Session end time (nullable)."},
      {"name": "source", "type": "VARCHAR(40)", "description": "Traffic source/medium or campaign."},
      {"name": "device", "type": "VARCHAR(40)", "description": "Device class such as mobile or desktop."},
      {"name": "country", "type": "CHAR(2)", "description": "ISO‑2 country of the session."}
    ]
  },
  {
    "table": "marketing_campaigns",
    "description": "Planned and active campaigns for acquisition and retention.",
    "columns": [
      {"name": "campaign_id", "type": "BIGINT", "description": "Primary key for the campaign."},
      {"name": "campaign_name", "type": "VARCHAR(160)", "description": "Human‑readable campaign label."},
      {"name": "channel", "type": "VARCHAR(40)", "description": "email, ads, social, affiliates, etc."},
      {"name": "budget", "type": "DECIMAL(14,2)", "description": "Allocated spend for the campaign."},
      {"name": "currency", "type": "CHAR(3)", "description": "Currency of budget."},
      {"name": "start_date", "type": "DATE", "description": "Campaign start date."},
      {"name": "end_date", "type": "DATE", "description": "Campaign end date (nullable)."}
    ]
  },
  {
    "table": "leads",
    "description": "Prospective customers captured by marketing or sales.",
    "columns": [
      {"name": "lead_id", "type": "BIGINT", "description": "Primary key for the lead."},
      {"name": "source", "type": "VARCHAR(40)", "description": "Origin of the lead such as web, event, referral."},
      {"name": "first_name", "type": "VARCHAR(80)", "description": "Lead’s given name."},
      {"name": "last_name", "type": "VARCHAR(80)", "description": "Lead’s family name."},
      {"name": "email", "type": "VARCHAR(255)", "description": "Contact email address (nullable)."},
      {"name": "company", "type": "VARCHAR(160)", "description": "Company name if B2B (nullable)."},
      {"name": "status", "type": "VARCHAR(20)", "description": "new, qualified, unqualified, converted."},
      {"name": "created_at", "type": "TIMESTAMP", "description": "Time the lead was created."}
    ]
  },
  {
    "table": "crm_interactions",
    "description": "Logged emails, calls, and meetings with leads or customers.",
    "columns": [
      {"name": "interaction_id", "type": "BIGINT", "description": "Primary key for the interaction."},
      {"name": "actor_employee_id", "type": "BIGINT", "description": "FK to employees who performed the interaction."},
      {"name": "lead_id", "type": "BIGINT", "description": "FK to leads (nullable if customer_id used)."},
      {"name": "customer_id", "type": "BIGINT", "description": "FK to customers (nullable if lead_id used)."},
      {"name": "channel", "type": "VARCHAR(20)", "description": "email, call, meeting, chat, etc."},
      {"name": "occurred_at", "type": "TIMESTAMP", "description": "When the interaction occurred."},
      {"name": "notes", "type": "TEXT", "description": "Free‑form summary of the interaction."}
    ]
  },
  {
    "table": "inventory",
    "description": "Current and reserved stock levels by product and location.",
    "columns": [
      {"name": "inventory_id", "type": "BIGINT", "description": "Primary key for the inventory record."},
      {"name": "product_id", "type": "BIGINT", "description": "FK to products."},
      {"name": "location_id", "type": "BIGINT", "description": "FK to locations (warehouse/store)."},
      {"name": "on_hand_qty", "type": "INT", "description": "Physical units currently available."},
      {"name": "reserved_qty", "type": "INT", "description": "Units reserved for open orders."},
      {"name": "reorder_point", "type": "INT", "description": "Threshold to trigger replenishment."},
      {"name": "last_restock_date", "type": "DATE", "description": "Date of last inbound stock."}
    ]
  }
]