CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/db-schema/email-counter.ts
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Table } from "./types";
7
8
Table({
9
name: "email_counter",
10
fields: {
11
id: {
12
type: "uuid",
13
desc: "The project, account or owner id. Who 'caused' these emails to get sent.",
14
},
15
count: {
16
type: "integer",
17
desc: "How many messages have been sent with given time.",
18
},
19
time: {
20
type: "timestamp",
21
desc: "Start of the time interval when these emails were sent (e.g., start of the day if we are counting up for a single day).",
22
},
23
expire: {
24
type: "timestamp",
25
},
26
},
27
rules: {
28
// using a compound primary key consisting of who and day we start.
29
primary_key: ["id", "time"],
30
},
31
});
32
33