- You should first reallocate PDA account size by adding additional 4bytes in your example. Remember you should not change account schema yet.
#[derive(Accounts)]
pub struct ResizeAccountA<'info> {
#[account(mut)]
pub payer: Signer<'info>,
#[account(mut, realloc = 8+4+4, realloc::payer = payer, realloc::zero = false)]
pub houseaccount_a: Account<'info, House>AccountA>,
pub system_program: Program<'info, System>,
}
- Now, you have added additional space for your AccountA to store new u32 data. Update your AccountA schema with
variable_b: u32
and add update instructions to update this new values which is set to 0 by default.
- After migration is done, you can get rid of update instruction if you no longer need it.