chore: 更新依赖、配置和代码生成
主要更新: - 更新 go.mod/go.sum 依赖 - 重新生成 Ent ORM 代码 - 更新 Wire 依赖注入配置 - 添加 docker-compose.override.yml 到 .gitignore - 更新 README 文档(Simple Mode 说明和已知问题) - 清理调试日志 - 其他代码优化和格式修复
This commit is contained in:
@@ -9,60 +9,6 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// APIKeysColumns holds the columns for the "api_keys" table.
|
||||
APIKeysColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
|
||||
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
|
||||
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
|
||||
{Name: "key", Type: field.TypeString, Unique: true, Size: 128},
|
||||
{Name: "name", Type: field.TypeString, Size: 100},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
|
||||
{Name: "group_id", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "user_id", Type: field.TypeInt64},
|
||||
}
|
||||
// APIKeysTable holds the schema information for the "api_keys" table.
|
||||
APIKeysTable = &schema.Table{
|
||||
Name: "api_keys",
|
||||
Columns: APIKeysColumns,
|
||||
PrimaryKey: []*schema.Column{APIKeysColumns[0]},
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "api_keys_groups_api_keys",
|
||||
Columns: []*schema.Column{APIKeysColumns[7]},
|
||||
RefColumns: []*schema.Column{GroupsColumns[0]},
|
||||
OnDelete: schema.SetNull,
|
||||
},
|
||||
{
|
||||
Symbol: "api_keys_users_api_keys",
|
||||
Columns: []*schema.Column{APIKeysColumns[8]},
|
||||
RefColumns: []*schema.Column{UsersColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "apikey_user_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{APIKeysColumns[8]},
|
||||
},
|
||||
{
|
||||
Name: "apikey_group_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{APIKeysColumns[7]},
|
||||
},
|
||||
{
|
||||
Name: "apikey_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{APIKeysColumns[6]},
|
||||
},
|
||||
{
|
||||
Name: "apikey_deleted_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{APIKeysColumns[3]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// AccountsColumns holds the columns for the "accounts" table.
|
||||
AccountsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
@@ -198,6 +144,60 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// APIKeysColumns holds the columns for the "api_keys" table.
|
||||
APIKeysColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
|
||||
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
|
||||
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
|
||||
{Name: "key", Type: field.TypeString, Unique: true, Size: 128},
|
||||
{Name: "name", Type: field.TypeString, Size: 100},
|
||||
{Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
|
||||
{Name: "group_id", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "user_id", Type: field.TypeInt64},
|
||||
}
|
||||
// APIKeysTable holds the schema information for the "api_keys" table.
|
||||
APIKeysTable = &schema.Table{
|
||||
Name: "api_keys",
|
||||
Columns: APIKeysColumns,
|
||||
PrimaryKey: []*schema.Column{APIKeysColumns[0]},
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "api_keys_groups_api_keys",
|
||||
Columns: []*schema.Column{APIKeysColumns[7]},
|
||||
RefColumns: []*schema.Column{GroupsColumns[0]},
|
||||
OnDelete: schema.SetNull,
|
||||
},
|
||||
{
|
||||
Symbol: "api_keys_users_api_keys",
|
||||
Columns: []*schema.Column{APIKeysColumns[8]},
|
||||
RefColumns: []*schema.Column{UsersColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "apikey_user_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{APIKeysColumns[8]},
|
||||
},
|
||||
{
|
||||
Name: "apikey_group_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{APIKeysColumns[7]},
|
||||
},
|
||||
{
|
||||
Name: "apikey_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{APIKeysColumns[6]},
|
||||
},
|
||||
{
|
||||
Name: "apikey_deleted_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{APIKeysColumns[3]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// GroupsColumns holds the columns for the "groups" table.
|
||||
GroupsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
@@ -368,8 +368,8 @@ var (
|
||||
{Name: "duration_ms", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "first_token_ms", Type: field.TypeInt, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
|
||||
{Name: "api_key_id", Type: field.TypeInt64},
|
||||
{Name: "account_id", Type: field.TypeInt64},
|
||||
{Name: "api_key_id", Type: field.TypeInt64},
|
||||
{Name: "group_id", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "user_id", Type: field.TypeInt64},
|
||||
{Name: "subscription_id", Type: field.TypeInt64, Nullable: true},
|
||||
@@ -381,15 +381,15 @@ var (
|
||||
PrimaryKey: []*schema.Column{UsageLogsColumns[0]},
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "usage_logs_api_keys_usage_logs",
|
||||
Symbol: "usage_logs_accounts_usage_logs",
|
||||
Columns: []*schema.Column{UsageLogsColumns[21]},
|
||||
RefColumns: []*schema.Column{APIKeysColumns[0]},
|
||||
RefColumns: []*schema.Column{AccountsColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
{
|
||||
Symbol: "usage_logs_accounts_usage_logs",
|
||||
Symbol: "usage_logs_api_keys_usage_logs",
|
||||
Columns: []*schema.Column{UsageLogsColumns[22]},
|
||||
RefColumns: []*schema.Column{AccountsColumns[0]},
|
||||
RefColumns: []*schema.Column{APIKeysColumns[0]},
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
{
|
||||
@@ -420,12 +420,12 @@ var (
|
||||
{
|
||||
Name: "usagelog_api_key_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{UsageLogsColumns[21]},
|
||||
Columns: []*schema.Column{UsageLogsColumns[22]},
|
||||
},
|
||||
{
|
||||
Name: "usagelog_account_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{UsageLogsColumns[22]},
|
||||
Columns: []*schema.Column{UsageLogsColumns[21]},
|
||||
},
|
||||
{
|
||||
Name: "usagelog_group_id",
|
||||
@@ -460,7 +460,7 @@ var (
|
||||
{
|
||||
Name: "usagelog_api_key_id_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{UsageLogsColumns[21], UsageLogsColumns[20]},
|
||||
Columns: []*schema.Column{UsageLogsColumns[22], UsageLogsColumns[20]},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -702,9 +702,9 @@ var (
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
APIKeysTable,
|
||||
AccountsTable,
|
||||
AccountGroupsTable,
|
||||
APIKeysTable,
|
||||
GroupsTable,
|
||||
ProxiesTable,
|
||||
RedeemCodesTable,
|
||||
@@ -719,11 +719,6 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
APIKeysTable.ForeignKeys[0].RefTable = GroupsTable
|
||||
APIKeysTable.ForeignKeys[1].RefTable = UsersTable
|
||||
APIKeysTable.Annotation = &entsql.Annotation{
|
||||
Table: "api_keys",
|
||||
}
|
||||
AccountsTable.ForeignKeys[0].RefTable = ProxiesTable
|
||||
AccountsTable.Annotation = &entsql.Annotation{
|
||||
Table: "accounts",
|
||||
@@ -733,6 +728,11 @@ func init() {
|
||||
AccountGroupsTable.Annotation = &entsql.Annotation{
|
||||
Table: "account_groups",
|
||||
}
|
||||
APIKeysTable.ForeignKeys[0].RefTable = GroupsTable
|
||||
APIKeysTable.ForeignKeys[1].RefTable = UsersTable
|
||||
APIKeysTable.Annotation = &entsql.Annotation{
|
||||
Table: "api_keys",
|
||||
}
|
||||
GroupsTable.Annotation = &entsql.Annotation{
|
||||
Table: "groups",
|
||||
}
|
||||
@@ -747,8 +747,8 @@ func init() {
|
||||
SettingsTable.Annotation = &entsql.Annotation{
|
||||
Table: "settings",
|
||||
}
|
||||
UsageLogsTable.ForeignKeys[0].RefTable = APIKeysTable
|
||||
UsageLogsTable.ForeignKeys[1].RefTable = AccountsTable
|
||||
UsageLogsTable.ForeignKeys[0].RefTable = AccountsTable
|
||||
UsageLogsTable.ForeignKeys[1].RefTable = APIKeysTable
|
||||
UsageLogsTable.ForeignKeys[2].RefTable = GroupsTable
|
||||
UsageLogsTable.ForeignKeys[3].RefTable = UsersTable
|
||||
UsageLogsTable.ForeignKeys[4].RefTable = UserSubscriptionsTable
|
||||
|
||||
Reference in New Issue
Block a user