Skip to content

Instantly share code, notes, and snippets.

@parsnips
Created December 11, 2020 06:48
Show Gist options
  • Save parsnips/6730bba43c10947f2f335f8ec31ff46a to your computer and use it in GitHub Desktop.
Save parsnips/6730bba43c10947f2f335f8ec31ff46a to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM template for the TX::Database::Schema resource type
Resources:
TestTable:
Type: TX::Database::Schema
Properties:
Tenant: "2f097c53-c8ea-4787-8d03-e34da43a6ac8"
Table:
{
"name": "miketest2",
"version": "miketest__V0001",
"schema": {
"document": {
"customerID": "uint",
"status": "string('ACTIVE')",
"forename": "string",
"surname": "string",
"phone": "string",
"email": "string",
"address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"zip": "string",
"country": "string('USA')"
},
"context": "{}"
},
"conditions": {
"emailContainsAt": "document.email.contains('@')"
},
"indexes": {
"primary": {
"key": {
"partition": [
"document.customerID"
]
},
"properties": {
"unique": true
}
},
"dynamic": {
"key": {
"partition": [
"uint(document.context.id)"
]
},
"conditions": {
"hasContextID": "has(document.context) && has(document.context.id)"
},
"properties": {
"unique": true
}
}
},
"joins": {
"customerAccounts": {
"index": "customerAccounts.indexes.primary",
"partition": [
"document.customerID"
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment