-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathUser.schema.ts
More file actions
25 lines (22 loc) · 858 Bytes
/
Copy pathUser.schema.ts
File metadata and controls
25 lines (22 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { t } from "@tailor-platform/sdk";
import { defineSchema } from "@tailor-platform/sdk/seed";
import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
import { user } from "../../tailordb/user";
const schemaType = t.object({
...user.pickFields(["id"], { optional: true }),
...user.omitFields(["id"]),
});
export const hook = createTailorDBHook(user);
export const schema = defineSchema(
createStandardSchema(schemaType, hook, user),
{
foreignKeys: [
{"column":"email","references":{"table":"_User","column":"name"}},
],
indexes: [
{"name":"user_email_unique_idx","columns":["email"],"unique":true},
{"name":"idx_name_department","columns":["name","department"],"unique":false},
{"name":"user_status_created_idx","columns":["status","createdAt"],"unique":false},
],
}
);