feat: update
This commit is contained in:
@@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS tenant_users(
|
||||
tenant_id bigint NOT NULL,
|
||||
user_id bigint NOT NULL,
|
||||
role TEXT[] NOT NULL DEFAULT ARRAY['member'],
|
||||
balance numeric(20, 8) NOT NULL DEFAULT 0,
|
||||
balance bigint NOT NULL DEFAULT 0,
|
||||
status varchar(50) NOT NULL DEFAULT 'active',
|
||||
created_at timestamptz NOT NULL DEFAULT NOW(),
|
||||
updated_at timestamptz NOT NULL DEFAULT NOW(),
|
||||
|
||||
@@ -22,7 +22,7 @@ type TenantUser struct {
|
||||
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
|
||||
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
|
||||
Role types.Array[consts.TenantUserRole] `gorm:"column:role;type:text[];not null;default:ARRAY['member" json:"role"`
|
||||
Balance float64 `gorm:"column:balance;type:numeric(20,8);not null" json:"balance"`
|
||||
Balance int64 `gorm:"column:balance;type:bigint;not null" json:"balance"`
|
||||
Status consts.UserStatus `gorm:"column:status;type:character varying(50);not null;default:active" json:"status"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;not null;default:now()" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;not null;default:now()" json:"updated_at"`
|
||||
|
||||
@@ -29,7 +29,7 @@ func newTenantUser(db *gorm.DB, opts ...gen.DOOption) tenantUserQuery {
|
||||
_tenantUserQuery.TenantID = field.NewInt64(tableName, "tenant_id")
|
||||
_tenantUserQuery.UserID = field.NewInt64(tableName, "user_id")
|
||||
_tenantUserQuery.Role = field.NewArray(tableName, "role")
|
||||
_tenantUserQuery.Balance = field.NewFloat64(tableName, "balance")
|
||||
_tenantUserQuery.Balance = field.NewInt64(tableName, "balance")
|
||||
_tenantUserQuery.Status = field.NewField(tableName, "status")
|
||||
_tenantUserQuery.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_tenantUserQuery.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
@@ -47,7 +47,7 @@ type tenantUserQuery struct {
|
||||
TenantID field.Int64
|
||||
UserID field.Int64
|
||||
Role field.Array
|
||||
Balance field.Float64
|
||||
Balance field.Int64
|
||||
Status field.Field
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
@@ -71,7 +71,7 @@ func (t *tenantUserQuery) updateTableName(table string) *tenantUserQuery {
|
||||
t.TenantID = field.NewInt64(table, "tenant_id")
|
||||
t.UserID = field.NewInt64(table, "user_id")
|
||||
t.Role = field.NewArray(table, "role")
|
||||
t.Balance = field.NewFloat64(table, "balance")
|
||||
t.Balance = field.NewInt64(table, "balance")
|
||||
t.Status = field.NewField(table, "status")
|
||||
t.CreatedAt = field.NewTime(table, "created_at")
|
||||
t.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
|
||||
Reference in New Issue
Block a user