mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-02-03 23:33:37 +08:00
350 lines
13 KiB
Go
350 lines
13 KiB
Go
// 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: "admin_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},
|
|
{Name: "asn", Type: field.TypeString},
|
|
{Name: "client_version", Type: field.TypeString},
|
|
{Name: "device", Type: field.TypeString},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "admin_login_histories", 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[11]},
|
|
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]},
|
|
}
|
|
// 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: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_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: "api_base", Type: field.TypeString},
|
|
{Name: "api_key", Type: field.TypeString},
|
|
{Name: "api_version", Type: field.TypeString, Nullable: true},
|
|
{Name: "description", Type: field.TypeString, Nullable: true},
|
|
{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[12]},
|
|
RefColumns: []*schema.Column{UsersColumns[0]},
|
|
OnDelete: schema.SetNull,
|
|
},
|
|
},
|
|
}
|
|
// RecordsColumns holds the columns for the "records" table.
|
|
RecordsColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID},
|
|
{Name: "task_id", Type: field.TypeString},
|
|
{Name: "model_type", Type: field.TypeString, Nullable: true},
|
|
{Name: "prompt", Type: field.TypeString, Nullable: true},
|
|
{Name: "completion", Type: field.TypeString, Nullable: true},
|
|
{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: "code_lines", Type: field.TypeInt64, Nullable: true},
|
|
{Name: "input_tokens", Type: field.TypeInt64},
|
|
{Name: "output_tokens", Type: field.TypeInt64},
|
|
{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},
|
|
}
|
|
// RecordsTable holds the schema information for the "records" table.
|
|
RecordsTable = &schema.Table{
|
|
Name: "records",
|
|
Columns: RecordsColumns,
|
|
PrimaryKey: []*schema.Column{RecordsColumns[0]},
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
{
|
|
Symbol: "records_models_records",
|
|
Columns: []*schema.Column{RecordsColumns[13]},
|
|
RefColumns: []*schema.Column{ModelsColumns[0]},
|
|
OnDelete: schema.SetNull,
|
|
},
|
|
{
|
|
Symbol: "records_users_records",
|
|
Columns: []*schema.Column{RecordsColumns[14]},
|
|
RefColumns: []*schema.Column{UsersColumns[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: "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]},
|
|
}
|
|
// UsersColumns holds the columns for the "users" table.
|
|
UsersColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID},
|
|
{Name: "username", Type: field.TypeString, Unique: true},
|
|
{Name: "password", Type: field.TypeString},
|
|
{Name: "email", Type: field.TypeString, Unique: true},
|
|
{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]},
|
|
}
|
|
// UserLoginHistoriesColumns holds the columns for the "user_login_histories" table.
|
|
UserLoginHistoriesColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeUUID},
|
|
{Name: "user_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},
|
|
{Name: "asn", Type: field.TypeString},
|
|
{Name: "client_version", Type: field.TypeString},
|
|
{Name: "device", Type: field.TypeString},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "user_login_histories", 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[11]},
|
|
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,
|
|
InviteCodesTable,
|
|
ModelsTable,
|
|
RecordsTable,
|
|
SettingsTable,
|
|
UsersTable,
|
|
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",
|
|
}
|
|
InviteCodesTable.Annotation = &entsql.Annotation{
|
|
Table: "invite_codes",
|
|
}
|
|
ModelsTable.ForeignKeys[0].RefTable = UsersTable
|
|
ModelsTable.Annotation = &entsql.Annotation{
|
|
Table: "models",
|
|
}
|
|
RecordsTable.ForeignKeys[0].RefTable = ModelsTable
|
|
RecordsTable.ForeignKeys[1].RefTable = UsersTable
|
|
RecordsTable.Annotation = &entsql.Annotation{
|
|
Table: "records",
|
|
}
|
|
SettingsTable.Annotation = &entsql.Annotation{
|
|
Table: "settings",
|
|
}
|
|
UsersTable.Annotation = &entsql.Annotation{
|
|
Table: "users",
|
|
}
|
|
UserLoginHistoriesTable.ForeignKeys[0].RefTable = UsersTable
|
|
UserLoginHistoriesTable.Annotation = &entsql.Annotation{
|
|
Table: "user_login_histories",
|
|
}
|
|
}
|