I've migrated from D6 to D7.
New user tries to register and receives the following error:

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'pass' at row 1: INSERT INTO {password_policy_history} (uid, pass, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 842 [:db_insert_placeholder_1] => $S$DsWFarKt2Zj4424tqu6uaFWIrbpl1EQgv.u2uZsoDO0GXEu5vam5 [:db_insert_placeholder_2] => 1357682933 ) in _password_policy_store_password() (line 1015 of sites/all/modules/password_policy/password_policy.module).

(note it is a different table error than in #1878044: Policy description field length not validated, so not a duplicate).

Comments

iva2k’s picture

I compared schema in D6 and D7, and it looks like length of 'pass' field in {password_policy_history} table has changed from 32 to 128. However there is no hook_update_N() that does that change. Hence the problem. I also looked into 7.x-2.x branch, and this is not addressed there either.

iva2k’s picture

Status: Active » Needs review

I've put this code together to bridge the gap between 6.x-1.x and 7.x-1.x from looking at schema differences:

/**
 * Perform schema conversions for D6 -> D7 migration.
 */
function password_policy_update_7101() {
  db_change_field('password_policy', 'expiration', 'expiration', array(
    'description' => t("The passwords will expire after this number of days."),
    'type' => 'int',
    'default' => 0,
  ), array());
  db_change_field('password_policy_history', 'pass', 'pass', array(
    'description' => "User's password (hashed).",
    'type' => 'varchar',
    'length' => 128,
    'not null' => TRUE,
    'default' => '',
  ), array());
}

Please review and paste into password_policy.install.

iva2k’s picture

Title: Error for new user registration » After D6->D7 migration, Error for new user registrations
erikwebb’s picture

Priority: Critical » Major
StatusFileSize
new1001 bytes
2faroffroad’s picture

iva2k thanks for your work on this...

Found table password_policy_history
updated pass to 128.
Fixed...
Thanks.

erikwebb’s picture

@2faroffroad - Did you test the patch or make a manual change?

erikwebb’s picture

Title: After D6->D7 migration, Error for new user registrations » Update schema for D7 upgrade
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.