@casekit/orm2-fixtures 1.0.0 → 1.0.2

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.
@@ -0,0 +1,19 @@
1
+ export declare const department: {
2
+ readonly fields: {
3
+ readonly id: {
4
+ readonly type: "serial";
5
+ readonly primaryKey: true;
6
+ };
7
+ readonly name: {
8
+ readonly type: "text";
9
+ };
10
+ };
11
+ readonly relations: {
12
+ readonly employees: {
13
+ readonly type: "1:N";
14
+ readonly model: "employee";
15
+ readonly fromField: "id";
16
+ readonly toField: "departmentId";
17
+ };
18
+ };
19
+ };
@@ -0,0 +1,14 @@
1
+ export const department = {
2
+ fields: {
3
+ id: { type: "serial", primaryKey: true },
4
+ name: { type: "text" },
5
+ },
6
+ relations: {
7
+ employees: {
8
+ type: "1:N",
9
+ model: "employee",
10
+ fromField: "id",
11
+ toField: "departmentId",
12
+ },
13
+ },
14
+ };
@@ -0,0 +1,32 @@
1
+ export declare const employee: {
2
+ readonly fields: {
3
+ readonly id: {
4
+ readonly type: "serial";
5
+ readonly primaryKey: true;
6
+ };
7
+ readonly name: {
8
+ readonly type: "text";
9
+ };
10
+ readonly departmentId: {
11
+ readonly type: "integer";
12
+ readonly references: {
13
+ readonly model: "department";
14
+ readonly field: "id";
15
+ };
16
+ };
17
+ };
18
+ readonly relations: {
19
+ readonly department: {
20
+ readonly type: "N:1";
21
+ readonly model: "department";
22
+ readonly fromField: "departmentId";
23
+ readonly toField: "id";
24
+ };
25
+ readonly tasks: {
26
+ readonly type: "1:N";
27
+ readonly model: "task";
28
+ readonly fromField: "id";
29
+ readonly toField: "assigneeId";
30
+ };
31
+ };
32
+ };
@@ -0,0 +1,27 @@
1
+ export const employee = {
2
+ fields: {
3
+ id: { type: "serial", primaryKey: true },
4
+ name: { type: "text" },
5
+ departmentId: {
6
+ type: "integer",
7
+ references: {
8
+ model: "department",
9
+ field: "id",
10
+ },
11
+ },
12
+ },
13
+ relations: {
14
+ department: {
15
+ type: "N:1",
16
+ model: "department",
17
+ fromField: "departmentId",
18
+ toField: "id",
19
+ },
20
+ tasks: {
21
+ type: "1:N",
22
+ model: "task",
23
+ fromField: "id",
24
+ toField: "assigneeId",
25
+ },
26
+ },
27
+ };
@@ -0,0 +1,32 @@
1
+ export declare const friendship: {
2
+ readonly fields: {
3
+ readonly userId: {
4
+ readonly type: "integer";
5
+ };
6
+ readonly friendId: {
7
+ readonly type: "integer";
8
+ };
9
+ };
10
+ readonly primaryKey: ["userId", "friendId"];
11
+ readonly relations: {
12
+ readonly user: {
13
+ readonly type: "N:1";
14
+ readonly model: "user";
15
+ readonly fromField: "userId";
16
+ readonly toField: "id";
17
+ };
18
+ readonly friend: {
19
+ readonly type: "N:1";
20
+ readonly model: "user";
21
+ readonly fromField: "friendId";
22
+ readonly toField: "id";
23
+ };
24
+ readonly stats: {
25
+ readonly type: "N:1";
26
+ readonly model: "friendshipStats";
27
+ readonly fromField: ["userId", "friendId"];
28
+ readonly toField: ["userId", "friendId"];
29
+ readonly optional: true;
30
+ };
31
+ };
32
+ };
@@ -1,5 +1,3 @@
1
- import { ModelDefinition } from "@casekit/orm2-schema";
2
-
3
1
  export const friendship = {
4
2
  fields: {
5
3
  userId: { type: "integer" },
@@ -27,4 +25,4 @@ export const friendship = {
27
25
  optional: true,
28
26
  },
29
27
  },
30
- } as const satisfies ModelDefinition;
28
+ };
@@ -0,0 +1,38 @@
1
+ export declare const friendshipStats: {
2
+ readonly fields: {
3
+ readonly id: {
4
+ readonly type: "serial";
5
+ readonly primaryKey: true;
6
+ };
7
+ readonly userId: {
8
+ readonly type: "integer";
9
+ };
10
+ readonly friendId: {
11
+ readonly type: "integer";
12
+ };
13
+ readonly messagesSent: {
14
+ readonly type: "integer";
15
+ readonly default: 0;
16
+ };
17
+ readonly likesGiven: {
18
+ readonly type: "integer";
19
+ readonly default: 0;
20
+ };
21
+ };
22
+ readonly foreignKeys: [{
23
+ readonly fields: ["userId", "friendId"];
24
+ readonly references: {
25
+ readonly model: "friendship";
26
+ readonly fields: ["userId", "friendId"];
27
+ };
28
+ readonly onDelete: "CASCADE";
29
+ }];
30
+ readonly relations: {
31
+ readonly friendship: {
32
+ readonly type: "N:1";
33
+ readonly model: "friendship";
34
+ readonly fromField: ["userId", "friendId"];
35
+ readonly toField: ["userId", "friendId"];
36
+ };
37
+ };
38
+ };
@@ -1,5 +1,3 @@
1
- import { ModelDefinition } from "@casekit/orm2-schema";
2
-
3
1
  export const friendshipStats = {
4
2
  fields: {
5
3
  id: { type: "serial", primaryKey: true },
@@ -26,4 +24,4 @@ export const friendshipStats = {
26
24
  toField: ["userId", "friendId"],
27
25
  },
28
26
  },
29
- } as const satisfies ModelDefinition;
27
+ };