fix(models): update models to use public schema and correct types
* Rename models to plural form for consistency * Change table names to include 'public' schema * Update timestamp types to SqlTimeStamp for consistency * Adjust relationships to use pluralized user models
This commit is contained in:
@@ -8,21 +8,21 @@ import (
|
||||
)
|
||||
|
||||
type ModelPublicMessageCache struct {
|
||||
bun.BaseModel `bun:"table:message_cache,alias:message_cache"`
|
||||
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
||||
AccountID resolvespec_common.SqlString `bun:"account_id,type:varchar(36),notnull," json:"account_id"`
|
||||
ChatID resolvespec_common.SqlString `bun:"chat_id,type:varchar(255),notnull," json:"chat_id"`
|
||||
Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` // JSON encoded message content
|
||||
CreatedAt resolvespec_common.SqlTime `bun:"created_at,type:timestamp,default:now(),notnull," json:"created_at"`
|
||||
FromMe bool `bun:"from_me,type:boolean,notnull," json:"from_me"`
|
||||
MessageID resolvespec_common.SqlString `bun:"message_id,type:varchar(255),notnull," json:"message_id"`
|
||||
MessageType resolvespec_common.SqlString `bun:"message_type,type:varchar(50),notnull," json:"message_type"` // text
|
||||
Timestamp resolvespec_common.SqlTime `bun:"timestamp,type:timestamp,notnull," json:"timestamp"`
|
||||
bun.BaseModel `bun:"table:public.message_cache,alias:message_cache"`
|
||||
ID resolvespec_common.SqlString `bun:"id,type:varchar(36),pk," json:"id"` // UUID
|
||||
AccountID resolvespec_common.SqlString `bun:"account_id,type:varchar(36),notnull," json:"account_id"`
|
||||
ChatID resolvespec_common.SqlString `bun:"chat_id,type:varchar(255),notnull," json:"chat_id"`
|
||||
Content resolvespec_common.SqlString `bun:"content,type:text,notnull," json:"content"` // JSON encoded message content
|
||||
CreatedAt resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamp,default:now(),notnull," json:"created_at"`
|
||||
FromMe bool `bun:"from_me,type:boolean,notnull," json:"from_me"`
|
||||
MessageID resolvespec_common.SqlString `bun:"message_id,type:varchar(255),notnull," json:"message_id"`
|
||||
MessageType resolvespec_common.SqlString `bun:"message_type,type:varchar(50),notnull," json:"message_type"` // text
|
||||
Timestamp resolvespec_common.SqlTimeStamp `bun:"timestamp,type:timestamp,notnull," json:"timestamp"`
|
||||
}
|
||||
|
||||
// TableName returns the table name for ModelPublicMessageCache
|
||||
func (m ModelPublicMessageCache) TableName() string {
|
||||
return "message_cache"
|
||||
return "public.message_cache"
|
||||
}
|
||||
|
||||
// TableNameOnly returns the table name without schema for ModelPublicMessageCache
|
||||
|
||||
Reference in New Issue
Block a user