Skip to content

Commit 80b2d98

Browse files
authored
feat: add lfxMemberships to Tinybird (#3336)
1 parent 2529144 commit 80b2d98

6 files changed

Lines changed: 86 additions & 0 deletions

backend/src/database/migrations/U1755171546__addLfxMembershipsToTinybird.sql

Whitespace-only changes.

backend/src/database/migrations/U1755245912__addOrganizationIdentitiesToTinybird.sql

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER PUBLICATION sequin_pub ADD TABLE "lfxMemberships";
2+
ALTER TABLE public."lfxMemberships" REPLICA IDENTITY FULL;
3+
4+
create index "ix_lfxMemberships_updatedAt_id" on "lfxMemberships" ("updatedAt", id);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER PUBLICATION sequin_pub ADD TABLE "organizationIdentities";
2+
ALTER TABLE public."organizationIdentities" REPLICA IDENTITY FULL;
3+
4+
create index "ix_organizationIdentities_updatedAt_with_pk" on "organizationIdentities" ("updatedAt", "organizationId", platform, type, value);
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
DESCRIPTION >
2+
- `lfxMemberships` contains LFX membership data tracking organization memberships and subscriptions.
3+
- Raw datasource replicated from Postgres - tracks organizational membership details and subscription information.
4+
- Links organizations to their LFX membership status, products, and pricing information.
5+
- `id` is the unique identifier for each membership record.
6+
- `organizationId` identifies the organization holding the membership.
7+
- `segmentId` links to project segments for filtering and organization.
8+
- `accountName` is the primary account name for the LFX membership.
9+
- `parentAccount` identifies parent/umbrella accounts for hierarchical relationships.
10+
- `project` specifies the associated project or initiative.
11+
- `productName` identifies the LFX product or service being subscribed to.
12+
- `purchaseHistoryName` contains the purchase history reference name.
13+
- `installDate` tracks when the membership/subscription was activated.
14+
- `usageEndDate` indicates when the membership/subscription expires or ends.
15+
- `status` shows the current membership status (active, expired, cancelled, etc.).
16+
- `priceCurrency` specifies the currency used for pricing (USD, EUR, etc.).
17+
- `price` contains the membership cost in the specified currency.
18+
- `productFamily` categorizes the product into product family.
19+
- `tier` indicates the membership tier or level.
20+
- `accountDomain` contains the primary domain associated with the account.
21+
- `domainAlias` is an array of alternative domains linked to the account.
22+
- `createdAt` and `updatedAt` are standard timestamp fields for record lifecycle tracking.
23+
24+
SCHEMA >
25+
`id` String `json:$.record.id`,
26+
`createdAt` DateTime64(3) `json:$.record.createdAt`,
27+
`updatedAt` DateTime64(3) `json:$.record.updatedAt`,
28+
`organizationId` String `json:$.record.organizationId` DEFAULT '',
29+
`segmentId` String `json:$.record.segmentId` DEFAULT '',
30+
`accountName` String `json:$.record.accountName`,
31+
`parentAccount` String `json:$.record.parentAccount` DEFAULT '',
32+
`project` String `json:$.record.project` DEFAULT '',
33+
`productName` String `json:$.record.productName`,
34+
`purchaseHistoryName` String `json:$.record.purchaseHistoryName`,
35+
`installDate` DateTime64(3) `json:$.record.installDate`,
36+
`usageEndDate` DateTime64(3) `json:$.record.usageEndDate`,
37+
`status` String `json:$.record.status`,
38+
`priceCurrency` String `json:$.record.priceCurrency`,
39+
`price` Int32 `json:$.record.price`,
40+
`productFamily` String `json:$.record.productFamily`,
41+
`tier` String `json:$.record.tier`,
42+
`accountDomain` String `json:$.record.accountDomain`,
43+
`domainAlias` Array(String) `json:$.record.domainAlias[:]` DEFAULT []
44+
45+
46+
ENGINE ReplacingMergeTree
47+
ENGINE_PARTITION_KEY toYear(createdAt)
48+
ENGINE_SORTING_KEY segmentId, organizationId, id
49+
ENGINE_VER updatedAt
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
DESCRIPTION >
2+
- `organizationIdentities` contains organization identity data tracking various platform identities and identifiers.
3+
- Raw datasource replicated from Postgres - tracks organizational identity information across different platforms.
4+
- Links organizations to their platform-specific identities and external source identifiers.
5+
- `organizationId` identifies the organization owning the identity.
6+
- `platform` specifies the platform where the identity exists (e.g., github, linkedin, crunchbase).
7+
- `sourceId` contains the external platform-specific identifier or ID.
8+
- `integrationId` links to the specific integration that provided this identity.
9+
- `verified` indicates whether the identity has been verified.
10+
- `type` specifies the type of identity.
11+
- `value` contains the actual identity value or identifier string.
12+
- `createdAt` and `updatedAt` are standard timestamp fields for record lifecycle tracking.
13+
14+
SCHEMA >
15+
`organizationId` String `json:$.record.organizationId`,
16+
`createdAt` DateTime64(3) `json:$.record.createdAt`,
17+
`updatedAt` DateTime64(3) `json:$.record.updatedAt`,
18+
`platform` String `json:$.record.platform`,
19+
`sourceId` String `json:$.record.sourceId` DEFAULT '',
20+
`integrationId` String `json:$.record.integrationId` DEFAULT '',
21+
`verified` UInt8 `json:$.record.verified` DEFAULT 0,
22+
`type` String `json:$.record.type`,
23+
`value` String `json:$.record.value`
24+
25+
26+
ENGINE ReplacingMergeTree
27+
ENGINE_PARTITION_KEY toYear(createdAt)
28+
ENGINE_SORTING_KEY organizationId, platform, type, value
29+
ENGINE_VER updatedAt

0 commit comments

Comments
 (0)