U4-10683 - Cannot invite new users on MySQL (Field 'userType' doesn't have a default value)

Created by Michele Di Maria 14 Nov 2017, 14:22:45 Updated by Shannon Deminick 02 Mar 2018, 00:42:09

Duplicates: U4-10472

On the MySQL version, when you invite a new user you receive the error:

{{2017-11-14 14:13:21,527 [P20744/D2/T199] ERROR Umbraco.Core.Persistence.UmbracoDatabase - Exception (1278db07). MySql.Data.MySqlClient.MySqlException (0x80004005): Field 'userType' doesn't have a default value at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar() at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass11_0.b__0() at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func) at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy cmdRetryPolicy, RetryPolicy conRetryPolicy) at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy retryPolicy) at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command) at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)}}

The workaround is to set a default value for the field umbracouser.userType, for example:

ALTER TABLE xxxxxx.umbracouser CHANGE COLUMN userType userType INT(11) NOT NULL DEFAULT '0'

I didn't try to drop the field, but this should be the definitive solution after the database has been migrated to UserGroups from UserTypes.


Shannon Deminick 02 Mar 2018, 00:41:25

The underlying cause for this is that the upgrader didn't properly execute or you've manually performed some database changes on the upgrade.

Version 7.7 doesn't have a userType table at all.

The upgrader is fixed in this issue: http://issues.umbraco.org/issue/U4-10683

Shannon Deminick 02 Mar 2018, 00:42:09

I've tested sending an invite when using MySql after running a successful upgrade with the above issue fixed

Priority: Normal

Type: Bug

State: Duplicate


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.7.4

Due in version:


Story Points: