Skip to main content
added 7 characters in body
Source Link
  1. 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>,
}
  1. 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.
  2. After migration is done, you can get rid of update instruction if you no longer need it.
  1. 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 house: Account<'info, House>,
    pub system_program: Program<'info, System>,
}
  1. 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.
  2. After migration is done, you can get rid of update instruction if you no longer need it.
  1. 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 account_a: Account<'info, AccountA>,
    pub system_program: Program<'info, System>,
}
  1. 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.
  2. After migration is done, you can get rid of update instruction if you no longer need it.
Source Link

  1. 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 house: Account<'info, House>,
    pub system_program: Program<'info, System>,
}
  1. 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.
  2. After migration is done, you can get rid of update instruction if you no longer need it.