diff --git a/backend/db/migrate/schema.go b/backend/db/migrate/schema.go index 0bae29d..e895f12 100644 --- a/backend/db/migrate/schema.go +++ b/backend/db/migrate/schema.go @@ -762,7 +762,7 @@ var ( // WorkspaceFilesColumns holds the columns for the "workspace_files" table. WorkspaceFilesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, - {Name: "path", Type: field.TypeString}, + {Name: "path", Type: field.TypeString, Size: 2147483647}, {Name: "content", Type: field.TypeString, Nullable: true, Size: 2147483647}, {Name: "hash", Type: field.TypeString}, {Name: "language", Type: field.TypeString, Nullable: true}, diff --git a/backend/ent/schema/workspacefile.go b/backend/ent/schema/workspacefile.go index e042c80..47da4ce 100644 --- a/backend/ent/schema/workspacefile.go +++ b/backend/ent/schema/workspacefile.go @@ -32,7 +32,7 @@ func (WorkspaceFile) Fields() []ent.Field { field.UUID("id", uuid.UUID{}), field.UUID("user_id", uuid.UUID{}).Comment("关联的用户ID"), field.UUID("workspace_id", uuid.UUID{}).Comment("关联的工作区ID"), - field.String("path").Validate(func(s string) error { + field.Text("path").Validate(func(s string) error { if s == "" { return fmt.Errorf("path cannot be empty") } diff --git a/backend/migration/000019_alter_workspace_files_path_column.down.sql b/backend/migration/000019_alter_workspace_files_path_column.down.sql new file mode 100644 index 0000000..0f0d477 --- /dev/null +++ b/backend/migration/000019_alter_workspace_files_path_column.down.sql @@ -0,0 +1,4 @@ +-- Alter workspace_files table to change path column from TEXT to VARCHAR(255) +-- Note: This operation may fail if any existing path values exceed 255 characters +ALTER TABLE workspace_files +ALTER COLUMN path TYPE VARCHAR(255); \ No newline at end of file diff --git a/backend/migration/000019_alter_workspace_files_path_column.up.sql b/backend/migration/000019_alter_workspace_files_path_column.up.sql new file mode 100644 index 0000000..00e3c22 --- /dev/null +++ b/backend/migration/000019_alter_workspace_files_path_column.up.sql @@ -0,0 +1,3 @@ +-- Alter workspace_files table to change path column from VARCHAR(255) to TEXT +ALTER TABLE workspace_files +ALTER COLUMN path TYPE TEXT; \ No newline at end of file