// Code generated by ent, DO NOT EDIT. package migrate import ( "entgo.io/ent/dialect/entsql" "entgo.io/ent/dialect/sql/schema" "entgo.io/ent/schema/field" ) var ( // AdminsColumns holds the columns for the "admins" table. AdminsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "username", Type: field.TypeString, Unique: true}, {Name: "password", Type: field.TypeString}, {Name: "status", Type: field.TypeString}, {Name: "last_active_at", Type: field.TypeTime}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // AdminsTable holds the schema information for the "admins" table. AdminsTable = &schema.Table{ Name: "admins", Columns: AdminsColumns, PrimaryKey: []*schema.Column{AdminsColumns[0]}, } // AdminLoginHistoriesColumns holds the columns for the "admin_login_histories" table. AdminLoginHistoriesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "ip", Type: field.TypeString}, {Name: "country", Type: field.TypeString}, {Name: "province", Type: field.TypeString}, {Name: "city", Type: field.TypeString}, {Name: "isp", Type: field.TypeString, Nullable: true}, {Name: "asn", Type: field.TypeString, Nullable: true}, {Name: "client_version", Type: field.TypeString, Nullable: true}, {Name: "device", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "admin_id", Type: field.TypeUUID, Nullable: true}, } // AdminLoginHistoriesTable holds the schema information for the "admin_login_histories" table. AdminLoginHistoriesTable = &schema.Table{ Name: "admin_login_histories", Columns: AdminLoginHistoriesColumns, PrimaryKey: []*schema.Column{AdminLoginHistoriesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "admin_login_histories_admins_login_histories", Columns: []*schema.Column{AdminLoginHistoriesColumns[10]}, RefColumns: []*schema.Column{AdminsColumns[0]}, OnDelete: schema.SetNull, }, }, } // APIKeysColumns holds the columns for the "api_keys" table. APIKeysColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "user_id", Type: field.TypeUUID}, {Name: "key", Type: field.TypeString}, {Name: "name", Type: field.TypeString}, {Name: "status", Type: field.TypeString, Default: "active"}, {Name: "last_used", Type: field.TypeTime, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // APIKeysTable holds the schema information for the "api_keys" table. APIKeysTable = &schema.Table{ Name: "api_keys", Columns: APIKeysColumns, PrimaryKey: []*schema.Column{APIKeysColumns[0]}, } // BillingPlansColumns holds the columns for the "billing_plans" table. BillingPlansColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "description", Type: field.TypeString}, {Name: "rules", Type: field.TypeJSON}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // BillingPlansTable holds the schema information for the "billing_plans" table. BillingPlansTable = &schema.Table{ Name: "billing_plans", Columns: BillingPlansColumns, PrimaryKey: []*schema.Column{BillingPlansColumns[0]}, } // BillingQuotasColumns holds the columns for the "billing_quotas" table. BillingQuotasColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "user_id", Type: field.TypeString, Unique: true}, {Name: "total", Type: field.TypeInt64}, {Name: "used", Type: field.TypeInt64}, {Name: "remain", Type: field.TypeInt64}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // BillingQuotasTable holds the schema information for the "billing_quotas" table. BillingQuotasTable = &schema.Table{ Name: "billing_quotas", Columns: BillingQuotasColumns, PrimaryKey: []*schema.Column{BillingQuotasColumns[0]}, } // BillingRecordsColumns holds the columns for the "billing_records" table. BillingRecordsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true}, {Name: "tenant_id", Type: field.TypeString, Unique: true}, {Name: "user_id", Type: field.TypeString, Unique: true}, {Name: "model", Type: field.TypeString}, {Name: "operation", Type: field.TypeString}, {Name: "input_tokens", Type: field.TypeInt64}, {Name: "output_tokens", Type: field.TypeInt64}, {Name: "cost", Type: field.TypeInt64}, {Name: "request_time", Type: field.TypeTime}, {Name: "metadata", Type: field.TypeJSON}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // BillingRecordsTable holds the schema information for the "billing_records" table. BillingRecordsTable = &schema.Table{ Name: "billing_records", Columns: BillingRecordsColumns, PrimaryKey: []*schema.Column{BillingRecordsColumns[0]}, } // BillingUsagesColumns holds the columns for the "billing_usages" table. BillingUsagesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "user_id", Type: field.TypeString, Unique: true}, {Name: "model_name", Type: field.TypeString}, {Name: "tokens", Type: field.TypeInt64}, {Name: "operation", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // BillingUsagesTable holds the schema information for the "billing_usages" table. BillingUsagesTable = &schema.Table{ Name: "billing_usages", Columns: BillingUsagesColumns, PrimaryKey: []*schema.Column{BillingUsagesColumns[0]}, } // ExtensionsColumns holds the columns for the "extensions" table. ExtensionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "version", Type: field.TypeString}, {Name: "path", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, } // ExtensionsTable holds the schema information for the "extensions" table. ExtensionsTable = &schema.Table{ Name: "extensions", Columns: ExtensionsColumns, PrimaryKey: []*schema.Column{ExtensionsColumns[0]}, } // InviteCodesColumns holds the columns for the "invite_codes" table. InviteCodesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "admin_id", Type: field.TypeUUID}, {Name: "code", Type: field.TypeString, Unique: true}, {Name: "status", Type: field.TypeString, Default: "pending"}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "expired_at", Type: field.TypeTime}, } // InviteCodesTable holds the schema information for the "invite_codes" table. InviteCodesTable = &schema.Table{ Name: "invite_codes", Columns: InviteCodesColumns, PrimaryKey: []*schema.Column{InviteCodesColumns[0]}, } // ModelsColumns holds the columns for the "models" table. ModelsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "model_name", Type: field.TypeString}, {Name: "model_type", Type: field.TypeString}, {Name: "show_name", Type: field.TypeString, Nullable: true}, {Name: "api_base", Type: field.TypeString}, {Name: "api_key", Type: field.TypeString}, {Name: "api_version", Type: field.TypeString, Nullable: true}, {Name: "api_header", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "is_internal", Type: field.TypeBool, Default: false}, {Name: "provider", Type: field.TypeString}, {Name: "status", Type: field.TypeString, Default: "active"}, {Name: "context_length", Type: field.TypeInt, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "user_id", Type: field.TypeUUID, Nullable: true}, } // ModelsTable holds the schema information for the "models" table. ModelsTable = &schema.Table{ Name: "models", Columns: ModelsColumns, PrimaryKey: []*schema.Column{ModelsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "models_users_models", Columns: []*schema.Column{ModelsColumns[15]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.SetNull, }, }, } // ModelProvidersColumns holds the columns for the "model_providers" table. ModelProvidersColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true}, {Name: "name", Type: field.TypeString}, {Name: "api_base", Type: field.TypeString}, {Name: "priority", Type: field.TypeInt, Default: 0}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // ModelProvidersTable holds the schema information for the "model_providers" table. ModelProvidersTable = &schema.Table{ Name: "model_providers", Columns: ModelProvidersColumns, PrimaryKey: []*schema.Column{ModelProvidersColumns[0]}, } // ModelProviderModelsColumns holds the columns for the "model_provider_models" table. ModelProviderModelsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "name", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "provider_id", Type: field.TypeString, Nullable: true}, } // ModelProviderModelsTable holds the schema information for the "model_provider_models" table. ModelProviderModelsTable = &schema.Table{ Name: "model_provider_models", Columns: ModelProviderModelsColumns, PrimaryKey: []*schema.Column{ModelProviderModelsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "model_provider_models_model_providers_models", Columns: []*schema.Column{ModelProviderModelsColumns[4]}, RefColumns: []*schema.Column{ModelProvidersColumns[0]}, OnDelete: schema.SetNull, }, }, } // SettingsColumns holds the columns for the "settings" table. SettingsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "enable_sso", Type: field.TypeBool, Default: false}, {Name: "force_two_factor_auth", Type: field.TypeBool, Default: false}, {Name: "disable_password_login", Type: field.TypeBool, Default: false}, {Name: "enable_auto_login", Type: field.TypeBool, Default: false}, {Name: "dingtalk_oauth", Type: field.TypeJSON, Nullable: true}, {Name: "custom_oauth", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // SettingsTable holds the schema information for the "settings" table. SettingsTable = &schema.Table{ Name: "settings", Columns: SettingsColumns, PrimaryKey: []*schema.Column{SettingsColumns[0]}, } // TasksColumns holds the columns for the "tasks" table. TasksColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "task_id", Type: field.TypeString, Unique: true}, {Name: "request_id", Type: field.TypeString, Nullable: true}, {Name: "model_type", Type: field.TypeString}, {Name: "is_accept", Type: field.TypeBool, Default: false}, {Name: "program_language", Type: field.TypeString, Nullable: true}, {Name: "work_mode", Type: field.TypeString, Nullable: true}, {Name: "prompt", Type: field.TypeString, Nullable: true}, {Name: "completion", Type: field.TypeString, Nullable: true}, {Name: "code_lines", Type: field.TypeInt64, Nullable: true}, {Name: "input_tokens", Type: field.TypeInt64, Nullable: true}, {Name: "output_tokens", Type: field.TypeInt64, Nullable: true}, {Name: "is_suggested", Type: field.TypeBool, Default: false}, {Name: "source_code", Type: field.TypeString, Nullable: true}, {Name: "cursor_position", Type: field.TypeJSON, Nullable: true}, {Name: "user_input", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "model_id", Type: field.TypeUUID, Nullable: true}, {Name: "user_id", Type: field.TypeUUID, Nullable: true}, } // TasksTable holds the schema information for the "tasks" table. TasksTable = &schema.Table{ Name: "tasks", Columns: TasksColumns, PrimaryKey: []*schema.Column{TasksColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "tasks_models_tasks", Columns: []*schema.Column{TasksColumns[18]}, RefColumns: []*schema.Column{ModelsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "tasks_users_tasks", Columns: []*schema.Column{TasksColumns[19]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.SetNull, }, }, } // TaskRecordsColumns holds the columns for the "task_records" table. TaskRecordsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "prompt", Type: field.TypeString, Nullable: true}, {Name: "role", Type: field.TypeString}, {Name: "completion", Type: field.TypeString}, {Name: "output_tokens", Type: field.TypeInt64}, {Name: "code_lines", Type: field.TypeInt64}, {Name: "code", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "task_id", Type: field.TypeUUID, Nullable: true}, } // TaskRecordsTable holds the schema information for the "task_records" table. TaskRecordsTable = &schema.Table{ Name: "task_records", Columns: TaskRecordsColumns, PrimaryKey: []*schema.Column{TaskRecordsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "task_records_tasks_task_records", Columns: []*schema.Column{TaskRecordsColumns[9]}, RefColumns: []*schema.Column{TasksColumns[0]}, OnDelete: schema.SetNull, }, }, } // UsersColumns holds the columns for the "users" table. UsersColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "username", Type: field.TypeString, Nullable: true}, {Name: "password", Type: field.TypeString, Nullable: true}, {Name: "email", Type: field.TypeString, Nullable: true}, {Name: "avatar_url", Type: field.TypeString, Nullable: true}, {Name: "platform", Type: field.TypeString, Default: "email"}, {Name: "status", Type: field.TypeString, Default: "active"}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // UsersTable holds the schema information for the "users" table. UsersTable = &schema.Table{ Name: "users", Columns: UsersColumns, PrimaryKey: []*schema.Column{UsersColumns[0]}, } // UserIdentitiesColumns holds the columns for the "user_identities" table. UserIdentitiesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "platform", Type: field.TypeString, Default: "email"}, {Name: "identity_id", Type: field.TypeString}, {Name: "union_id", Type: field.TypeString, Nullable: true}, {Name: "nickname", Type: field.TypeString, Nullable: true}, {Name: "email", Type: field.TypeString, Nullable: true}, {Name: "avatar_url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "user_id", Type: field.TypeUUID, Nullable: true}, } // UserIdentitiesTable holds the schema information for the "user_identities" table. UserIdentitiesTable = &schema.Table{ Name: "user_identities", Columns: UserIdentitiesColumns, PrimaryKey: []*schema.Column{UserIdentitiesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_identities_users_identities", Columns: []*schema.Column{UserIdentitiesColumns[9]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.SetNull, }, }, } // UserLoginHistoriesColumns holds the columns for the "user_login_histories" table. UserLoginHistoriesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "ip", Type: field.TypeString}, {Name: "country", Type: field.TypeString}, {Name: "province", Type: field.TypeString}, {Name: "city", Type: field.TypeString}, {Name: "isp", Type: field.TypeString, Nullable: true}, {Name: "asn", Type: field.TypeString, Nullable: true}, {Name: "client_version", Type: field.TypeString, Nullable: true}, {Name: "os_type", Type: field.TypeString, Nullable: true}, {Name: "os_release", Type: field.TypeString, Nullable: true}, {Name: "hostname", Type: field.TypeString, Nullable: true}, {Name: "client_id", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "user_id", Type: field.TypeUUID, Nullable: true}, } // UserLoginHistoriesTable holds the schema information for the "user_login_histories" table. UserLoginHistoriesTable = &schema.Table{ Name: "user_login_histories", Columns: UserLoginHistoriesColumns, PrimaryKey: []*schema.Column{UserLoginHistoriesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_login_histories_users_login_histories", Columns: []*schema.Column{UserLoginHistoriesColumns[13]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.SetNull, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ AdminsTable, AdminLoginHistoriesTable, APIKeysTable, BillingPlansTable, BillingQuotasTable, BillingRecordsTable, BillingUsagesTable, ExtensionsTable, InviteCodesTable, ModelsTable, ModelProvidersTable, ModelProviderModelsTable, SettingsTable, TasksTable, TaskRecordsTable, UsersTable, UserIdentitiesTable, UserLoginHistoriesTable, } ) func init() { AdminsTable.Annotation = &entsql.Annotation{ Table: "admins", } AdminLoginHistoriesTable.ForeignKeys[0].RefTable = AdminsTable AdminLoginHistoriesTable.Annotation = &entsql.Annotation{ Table: "admin_login_histories", } APIKeysTable.Annotation = &entsql.Annotation{ Table: "api_keys", } BillingPlansTable.Annotation = &entsql.Annotation{ Table: "billing_plans", } BillingQuotasTable.Annotation = &entsql.Annotation{ Table: "billing_quotas", } BillingRecordsTable.Annotation = &entsql.Annotation{ Table: "billing_records", } BillingUsagesTable.Annotation = &entsql.Annotation{ Table: "billing_usages", } ExtensionsTable.Annotation = &entsql.Annotation{ Table: "extensions", } InviteCodesTable.Annotation = &entsql.Annotation{ Table: "invite_codes", } ModelsTable.ForeignKeys[0].RefTable = UsersTable ModelsTable.Annotation = &entsql.Annotation{ Table: "models", } ModelProvidersTable.Annotation = &entsql.Annotation{ Table: "model_providers", } ModelProviderModelsTable.ForeignKeys[0].RefTable = ModelProvidersTable ModelProviderModelsTable.Annotation = &entsql.Annotation{ Table: "model_provider_models", } SettingsTable.Annotation = &entsql.Annotation{ Table: "settings", } TasksTable.ForeignKeys[0].RefTable = ModelsTable TasksTable.ForeignKeys[1].RefTable = UsersTable TasksTable.Annotation = &entsql.Annotation{ Table: "tasks", } TaskRecordsTable.ForeignKeys[0].RefTable = TasksTable TaskRecordsTable.Annotation = &entsql.Annotation{ Table: "task_records", } UsersTable.Annotation = &entsql.Annotation{ Table: "users", } UserIdentitiesTable.ForeignKeys[0].RefTable = UsersTable UserIdentitiesTable.Annotation = &entsql.Annotation{ Table: "user_identities", } UserLoginHistoriesTable.ForeignKeys[0].RefTable = UsersTable UserLoginHistoriesTable.Annotation = &entsql.Annotation{ Table: "user_login_histories", } }