Blog Custom Feild Bug
The Custom field editor allows me to specify BIT on the type, but it tries to ALTER TABLE with bit(255) which fails, and then renders the entire site hosed because it keeps trying to insert the bogus datatype
I tried removing the mapping from the BlogConfig but that didn't work
[OpenAccessException: SQL exception on 'ALTER TABLE [sf_blog_posts] ALTER COLUMN [showImage] BIT(255) NULL' : Column, parameter, or variable #0: Cannot specify a column width on data type bit.] Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +7 OpenAccessRuntime.DataObjects.tools.ant.DataObjectsTaskBase.throwBuildException(String str, Exception e) +36 OpenAccessRuntime.DataObjects.tools.ant.DataObjectsTaskBase.ExecuteSqlScript(String script, Connection con, SqlDriver sqlDriver, Boolean noShredder) +365 OpenAccessRuntime.DataObjects.tools.ant.DataObjectsTaskBase.runScript(String script) +111 OpenAccessRuntime.DataObjects.tools.ant.ExecuteScriptTask.execute() +288
Hello Steve,
Yes, you are right. There is no validation for adding a custom field with incorrect db type, and unfortunately sometimes this could cause application to crash.
The only way to fix this problem is to delete the meta field directly in the database. In your case, the SQL script should be the following:
DELETE
FROM
sf_mt_fields_sf_meta_attribute
WHERE
id
IN
(
SELECT
id
FROM
sf_meta_fields
WHERE
type_id
IN
(
SELECT
id
FROM
sf_meta_types
WHERE
assembly_name =
'Telerik.Sitefinity.Model'
AND
class_name =
'BlogPost'
)
AND
(column_name
is
null
AND
field_name =
'showImage'
)
OR
((column_name =
'showImage'
)))
DELETE
FROM
sf_meta_fields
WHERE
(type_id
IN
(
SELECT
id
FROM
sf_meta_types
WHERE
assembly_name =
'Telerik.Sitefinity.Model'
AND
class_name =
'BlogPost'
))
AND
(column_name
is
null
AND
field_name =
'showImage'
)
OR
((column_name =
'showImage'
))