CreateActivitySchema
Creates an RSD for one Activity Feed type by sampling a single matching activity. The generated view filters activity_types[] to ActivityType, flattens nested objects, includes type-specific fields from the sample, and preserves variable-length arrays as JSON.
Stored Procedure-Specific Information
ActivityType is required. Obtain values from Activities.Type or the Compliance Activity Feed documentation. FileName and FileStream are optional.
The generated view supports server-side ORDER BY CreatedAt ASC and ORDER BY CreatedAt DESC. When FileName is supplied, its basename becomes TableName; for example, test_account_deleted.rsd creates the test_account_deleted view. Without FileName, the component assigns an activity-derived name, appending _1, _2, and so on when the name collides with an existing table.
Supply FileStream to receive the RSD as a stream. If neither FileName nor FileStream is supplied, the procedure returns Result, TableName, and base64 FileData.
In SQL string literals, use forward slashes in a Windows path, or escape every backslash as \\.
To execute this procedure, enter:
EXEC CreateActivitySchema ActivityType = 'account_deleted';
EXEC CreateActivitySchema ActivityType = 'claude_code_review_config_updated', FileName = 'C:/Schemas/ClaudeCodeReviewConfigUpdated.rsd';
EXEC CreateActivitySchema ActivityType = 'claude_code_review_config_updated', FileName = 'C:\\Schemas\\ClaudeCodeReviewConfigUpdated.rsd';
Input
| Name | Type | Required | Description |
| ActivityType | String | True | The Activity Feed type to model, for example account_deleted. Required: Obtain valid values from Activities.Type or the Compliance Activity Feed documentation. |
| FileName | String | False | Optional path for the generated .rsd file. Its basename becomes TableName, for example test_account_deleted.rsd creates the test_account_deleted view. In a SQL literal, use forward slashes (C:/Schemas/view.rsd) or escape Windows backslashes (C:\\Schemas\\view.rsd). Without this input the procedure returns FileData. |
Result Set Columns
| Name | Type | Description |
| Result | String | Success when the schema was generated. |
| TableName | String | The generated typed view name. With FileName it is the file basename; otherwise collisions are resolved with _1, _2, and so on. |
| FileData | String | The generated RSD encoded as base64 when FileName and FileStream are not supplied. |