|
| 1 | +////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | +// DO NOT MODIFY THIS FILE // |
| 3 | +// This file is automatically generated by ZenStack CLI and should not be manually updated. // |
| 4 | +////////////////////////////////////////////////////////////////////////////////////////////// |
| 5 | + |
| 6 | +/* eslint-disable */ |
| 7 | + |
| 8 | +import { type SchemaDef, type AttributeApplication, type FieldDefault, ExpressionUtils } from "@zenstackhq/schema"; |
| 9 | +export class SchemaType implements SchemaDef { |
| 10 | + provider = { |
| 11 | + type: "sqlite" |
| 12 | + } as const; |
| 13 | + models = { |
| 14 | + User: { |
| 15 | + name: "User", |
| 16 | + fields: { |
| 17 | + id: { |
| 18 | + name: "id", |
| 19 | + type: "String", |
| 20 | + id: true, |
| 21 | + attributes: [{ name: "@id" }, { name: "@default", args: [{ name: "value", value: ExpressionUtils.call("cuid") }] }] as readonly AttributeApplication[], |
| 22 | + default: ExpressionUtils.call("cuid") as FieldDefault |
| 23 | + }, |
| 24 | + email: { |
| 25 | + name: "email", |
| 26 | + type: "String", |
| 27 | + unique: true, |
| 28 | + attributes: [{ name: "@unique" }, { name: "@email" }, { name: "@length", args: [{ name: "min", value: ExpressionUtils.literal(6) }, { name: "max", value: ExpressionUtils.literal(32) }] }] as readonly AttributeApplication[] |
| 29 | + }, |
| 30 | + posts: { |
| 31 | + name: "posts", |
| 32 | + type: "Post", |
| 33 | + array: true, |
| 34 | + relation: { opposite: "author" } |
| 35 | + } |
| 36 | + }, |
| 37 | + idFields: ["id"], |
| 38 | + uniqueFields: { |
| 39 | + id: { type: "String" }, |
| 40 | + email: { type: "String" } |
| 41 | + } |
| 42 | + }, |
| 43 | + Post: { |
| 44 | + name: "Post", |
| 45 | + fields: { |
| 46 | + id: { |
| 47 | + name: "id", |
| 48 | + type: "String", |
| 49 | + id: true, |
| 50 | + attributes: [{ name: "@id" }, { name: "@default", args: [{ name: "value", value: ExpressionUtils.call("cuid") }] }] as readonly AttributeApplication[], |
| 51 | + default: ExpressionUtils.call("cuid") as FieldDefault |
| 52 | + }, |
| 53 | + createdAt: { |
| 54 | + name: "createdAt", |
| 55 | + type: "DateTime", |
| 56 | + attributes: [{ name: "@default", args: [{ name: "value", value: ExpressionUtils.call("now") }] }] as readonly AttributeApplication[], |
| 57 | + default: ExpressionUtils.call("now") as FieldDefault |
| 58 | + }, |
| 59 | + updatedAt: { |
| 60 | + name: "updatedAt", |
| 61 | + type: "DateTime", |
| 62 | + updatedAt: true, |
| 63 | + attributes: [{ name: "@updatedAt" }] as readonly AttributeApplication[] |
| 64 | + }, |
| 65 | + title: { |
| 66 | + name: "title", |
| 67 | + type: "String", |
| 68 | + attributes: [{ name: "@length", args: [{ name: "min", value: ExpressionUtils.literal(1) }, { name: "max", value: ExpressionUtils.literal(256) }] }] as readonly AttributeApplication[] |
| 69 | + }, |
| 70 | + content: { |
| 71 | + name: "content", |
| 72 | + type: "String" |
| 73 | + }, |
| 74 | + published: { |
| 75 | + name: "published", |
| 76 | + type: "Boolean", |
| 77 | + attributes: [{ name: "@default", args: [{ name: "value", value: ExpressionUtils.literal(false) }] }] as readonly AttributeApplication[], |
| 78 | + default: false as FieldDefault |
| 79 | + }, |
| 80 | + author: { |
| 81 | + name: "author", |
| 82 | + type: "User", |
| 83 | + attributes: [{ name: "@relation", args: [{ name: "fields", value: ExpressionUtils.array("String", [ExpressionUtils.field("authorId")]) }, { name: "references", value: ExpressionUtils.array("String", [ExpressionUtils.field("id")]) }, { name: "onDelete", value: ExpressionUtils.literal("Cascade") }] }] as readonly AttributeApplication[], |
| 84 | + relation: { opposite: "posts", fields: ["authorId"], references: ["id"], onDelete: "Cascade" } |
| 85 | + }, |
| 86 | + authorId: { |
| 87 | + name: "authorId", |
| 88 | + type: "String", |
| 89 | + foreignKeyFor: [ |
| 90 | + "author" |
| 91 | + ] as readonly string[] |
| 92 | + } |
| 93 | + }, |
| 94 | + idFields: ["id"], |
| 95 | + uniqueFields: { |
| 96 | + id: { type: "String" } |
| 97 | + } |
| 98 | + } |
| 99 | + } as const; |
| 100 | + authType = "User" as const; |
| 101 | + plugins = {}; |
| 102 | +} |
| 103 | +export const schema = new SchemaType(); |
0 commit comments