Welcome Guest, Not a member yet? Register   Sign In
Migrate users to shield
#1

(This post was last modified: 02-14-2024, 10:51 AM by frocco.)

Hello,

I am using migrations to insert users from another application to shield users table.
I need to preserve the previous id value and insert it as the current id.
shield will not allow me to replace the primary key id with current value.

I cannot get this to work.

Code:
$user = new User([
                "id" => $row->id, // Previous id from other database table
  ]);
$model = new UserModel;
            $model->save($user);

            $user = $model->findById($model->getInsertID());
            $user->activate();
Reply


Messages In This Thread
Migrate users to shield - by frocco - 02-14-2024, 10:50 AM
RE: Migrate users to shield - by kenjis - 02-14-2024, 05:06 PM
RE: Migrate users to shield - by frocco - 02-14-2024, 05:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB