@hogsend/db 0.22.0 → 0.23.1
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/package.json
CHANGED
|
@@ -14,9 +14,23 @@ export const trackedLinks = pgTable(
|
|
|
14
14
|
"tracked_links",
|
|
15
15
|
{
|
|
16
16
|
id: uuid("id").defaultRandom().primaryKey(),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
// NULLABLE since the identity-stitching minor: a tracked link no longer has
|
|
18
|
+
// to belong to an email send. Broadcast/non-email links (Discord, referral,
|
|
19
|
+
// ad-hoc `createTrackedLink`) carry NULL here. Email-link inserts keep
|
|
20
|
+
// populating it; the FK + index are unchanged.
|
|
21
|
+
emailSendId: uuid("email_send_id").references(() => emailSends.id, {
|
|
22
|
+
onDelete: "cascade",
|
|
23
|
+
}),
|
|
24
|
+
// Subject of a stitch-bearing NON-email link: the canonical contact key the
|
|
25
|
+
// click should fold the visitor's anon session into. NULL for broadcast
|
|
26
|
+
// links (Discord/referral default) — broadcast links are tracked for click
|
|
27
|
+
// counts but carry no identity. Email links resolve their subject from the
|
|
28
|
+
// `email_sends` row instead, so this stays NULL for them too.
|
|
29
|
+
distinctId: text("distinct_id"),
|
|
30
|
+
// Where the link originated: "email" | "discord" | "link". Drives the click
|
|
31
|
+
// route's per-hit outbound emit (email links emit `email.clicked`; non-email
|
|
32
|
+
// links emit `link.clicked`). NULL on legacy/email rows.
|
|
33
|
+
source: text("source"),
|
|
20
34
|
originalUrl: text("original_url").notNull(),
|
|
21
35
|
clickCount: integer("click_count").notNull().default(0),
|
|
22
36
|
// Semantic link metadata, lifted from the template's data-hs-* attributes
|