//! This code was AUTOGENERATED using the Codama library.
pub mod add_assets_to_group_v1_row;
pub mod add_collection_external_plugin_adapter_v1_row;
pub mod add_collection_plugin_v1_row;
pub mod add_collections_to_group_v1_row;
pub mod add_external_plugin_adapter_v1_row;
pub mod add_groups_to_group_v1_row;
pub mod add_plugin_v1_row;
pub mod approve_collection_plugin_authority_v1_row;
pub mod approve_plugin_authority_v1_row;
pub mod burn_collection_v1_row;
pub mod burn_v1_row;
pub mod close_group_v1_row;
pub mod collect_row;
pub mod compress_v1_row;
pub mod create_collection_v1_row;
pub mod create_collection_v2_row;
pub mod create_group_v1_row;
pub mod create_v1_row;
pub mod create_v2_row;
pub mod decompress_v1_row;
pub mod execute_v1_row;
pub mod remove_assets_from_group_v1_row;
pub mod remove_collection_external_plugin_adapter_v1_row;
pub mod remove_collection_plugin_v1_row;
pub mod remove_collections_from_group_v1_row;
pub mod remove_external_plugin_adapter_v1_row;
pub mod remove_groups_from_group_v1_row;
pub mod remove_plugin_v1_row;
pub mod revoke_collection_plugin_authority_v1_row;
pub mod revoke_plugin_authority_v1_row;
pub mod transfer_v1_row;
pub mod update_collection_external_plugin_adapter_v1_row;
pub mod update_collection_info_v1_row;
pub mod update_collection_plugin_v1_row;
pub mod update_collection_v1_row;
pub mod update_external_plugin_adapter_v1_row;
pub mod update_group_v1_row;
pub mod update_plugin_v1_row;
pub mod update_v1_row;
pub mod update_v2_row;
pub mod write_collection_external_plugin_adapter_data_v1_row;
pub mod write_external_plugin_adapter_data_v1_row;

pub use self::{
    add_assets_to_group_v1_row::*, add_collection_external_plugin_adapter_v1_row::*,
    add_collection_plugin_v1_row::*, add_collections_to_group_v1_row::*,
    add_external_plugin_adapter_v1_row::*, add_groups_to_group_v1_row::*, add_plugin_v1_row::*,
    approve_collection_plugin_authority_v1_row::*, approve_plugin_authority_v1_row::*,
    burn_collection_v1_row::*, burn_v1_row::*, close_group_v1_row::*, collect_row::*,
    compress_v1_row::*, create_collection_v1_row::*, create_collection_v2_row::*,
    create_group_v1_row::*, create_v1_row::*, create_v2_row::*, decompress_v1_row::*,
    execute_v1_row::*, remove_assets_from_group_v1_row::*,
    remove_collection_external_plugin_adapter_v1_row::*, remove_collection_plugin_v1_row::*,
    remove_collections_from_group_v1_row::*, remove_external_plugin_adapter_v1_row::*,
    remove_groups_from_group_v1_row::*, remove_plugin_v1_row::*,
    revoke_collection_plugin_authority_v1_row::*, revoke_plugin_authority_v1_row::*,
    transfer_v1_row::*, update_collection_external_plugin_adapter_v1_row::*,
    update_collection_info_v1_row::*, update_collection_plugin_v1_row::*,
    update_collection_v1_row::*, update_external_plugin_adapter_v1_row::*, update_group_v1_row::*,
    update_plugin_v1_row::*, update_v1_row::*, update_v2_row::*,
    write_collection_external_plugin_adapter_data_v1_row::*,
    write_external_plugin_adapter_data_v1_row::*,
};
use super::MplCoreInstruction;

pub struct MplCoreInstructionsMigration;

impl sqlx_migrator::Migration<sqlx::Postgres> for MplCoreInstructionsMigration {
    fn app(&self) -> &str {
        "mpl-core"
    }

    fn name(&self) -> &str {
        "mpl_core_instructions"
    }

    fn operations(&self) -> Vec<Box<dyn sqlx_migrator::Operation<sqlx::Postgres>>> {
        vec![
            Box::new(AddAssetsToGroupV1MigrationOperation),
            Box::new(AddCollectionExternalPluginAdapterV1MigrationOperation),
            Box::new(AddCollectionPluginV1MigrationOperation),
            Box::new(AddCollectionsToGroupV1MigrationOperation),
            Box::new(AddExternalPluginAdapterV1MigrationOperation),
            Box::new(AddGroupsToGroupV1MigrationOperation),
            Box::new(AddPluginV1MigrationOperation),
            Box::new(ApproveCollectionPluginAuthorityV1MigrationOperation),
            Box::new(ApprovePluginAuthorityV1MigrationOperation),
            Box::new(BurnCollectionV1MigrationOperation),
            Box::new(BurnV1MigrationOperation),
            Box::new(CloseGroupV1MigrationOperation),
            Box::new(CollectMigrationOperation),
            Box::new(CompressV1MigrationOperation),
            Box::new(CreateCollectionV1MigrationOperation),
            Box::new(CreateCollectionV2MigrationOperation),
            Box::new(CreateGroupV1MigrationOperation),
            Box::new(CreateV1MigrationOperation),
            Box::new(CreateV2MigrationOperation),
            Box::new(DecompressV1MigrationOperation),
            Box::new(ExecuteV1MigrationOperation),
            Box::new(RemoveAssetsFromGroupV1MigrationOperation),
            Box::new(RemoveCollectionExternalPluginAdapterV1MigrationOperation),
            Box::new(RemoveCollectionPluginV1MigrationOperation),
            Box::new(RemoveCollectionsFromGroupV1MigrationOperation),
            Box::new(RemoveExternalPluginAdapterV1MigrationOperation),
            Box::new(RemoveGroupsFromGroupV1MigrationOperation),
            Box::new(RemovePluginV1MigrationOperation),
            Box::new(RevokeCollectionPluginAuthorityV1MigrationOperation),
            Box::new(RevokePluginAuthorityV1MigrationOperation),
            Box::new(TransferV1MigrationOperation),
            Box::new(UpdateCollectionExternalPluginAdapterV1MigrationOperation),
            Box::new(UpdateCollectionInfoV1MigrationOperation),
            Box::new(UpdateCollectionPluginV1MigrationOperation),
            Box::new(UpdateCollectionV1MigrationOperation),
            Box::new(UpdateExternalPluginAdapterV1MigrationOperation),
            Box::new(UpdateGroupV1MigrationOperation),
            Box::new(UpdatePluginV1MigrationOperation),
            Box::new(UpdateV1MigrationOperation),
            Box::new(UpdateV2MigrationOperation),
            Box::new(WriteCollectionExternalPluginAdapterDataV1MigrationOperation),
            Box::new(WriteExternalPluginAdapterDataV1MigrationOperation),
        ]
    }

    fn parents(&self) -> Vec<Box<dyn sqlx_migrator::Migration<sqlx::Postgres>>> {
        vec![]
    }
}

pub struct MplCoreInstructionWithMetadata(
    pub MplCoreInstruction,
    pub carbon_core::instruction::InstructionMetadata,
    pub Vec<solana_instruction::AccountMeta>,
);

impl
    From<(
        MplCoreInstruction,
        carbon_core::instruction::InstructionMetadata,
        Vec<solana_instruction::AccountMeta>,
    )> for MplCoreInstructionWithMetadata
{
    fn from(
        value: (
            MplCoreInstruction,
            carbon_core::instruction::InstructionMetadata,
            Vec<solana_instruction::AccountMeta>,
        ),
    ) -> Self {
        MplCoreInstructionWithMetadata(value.0, value.1, value.2)
    }
}

#[async_trait::async_trait]
impl carbon_core::postgres::operations::Insert for MplCoreInstructionWithMetadata {
    async fn insert(&self, pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
        let MplCoreInstructionWithMetadata(decoded_instruction, metadata, raw_accounts) = self;
        match decoded_instruction {
            MplCoreInstruction::CreateV1 { data, .. } => {
                let row = create_v1_row::CreateV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CreateCollectionV1 { data, .. } => {
                let row = create_collection_v1_row::CreateCollectionV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddPluginV1 { data, .. } => {
                let row = add_plugin_v1_row::AddPluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddCollectionPluginV1 { data, .. } => {
                let row = add_collection_plugin_v1_row::AddCollectionPluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemovePluginV1 { data, .. } => {
                let row = remove_plugin_v1_row::RemovePluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveCollectionPluginV1 { data, .. } => {
                let row = remove_collection_plugin_v1_row::RemoveCollectionPluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdatePluginV1 { data, .. } => {
                let row = update_plugin_v1_row::UpdatePluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateCollectionPluginV1 { data, .. } => {
                let row = update_collection_plugin_v1_row::UpdateCollectionPluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::ApprovePluginAuthorityV1 { data, .. } => {
                let row = approve_plugin_authority_v1_row::ApprovePluginAuthorityV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::ApproveCollectionPluginAuthorityV1 { data, .. } => {
                let row = approve_collection_plugin_authority_v1_row::ApproveCollectionPluginAuthorityV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RevokePluginAuthorityV1 { data, .. } => {
                let row = revoke_plugin_authority_v1_row::RevokePluginAuthorityV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RevokeCollectionPluginAuthorityV1 { data, .. } => {
                let row = revoke_collection_plugin_authority_v1_row::RevokeCollectionPluginAuthorityV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::BurnV1 { data, .. } => {
                let row = burn_v1_row::BurnV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::BurnCollectionV1 { data, .. } => {
                let row = burn_collection_v1_row::BurnCollectionV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::TransferV1 { data, .. } => {
                let row = transfer_v1_row::TransferV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateV1 { data, .. } => {
                let row = update_v1_row::UpdateV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateCollectionV1 { data, .. } => {
                let row = update_collection_v1_row::UpdateCollectionV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CompressV1 { data, .. } => {
                let row = compress_v1_row::CompressV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::DecompressV1 { data, .. } => {
                let row = decompress_v1_row::DecompressV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::Collect { data, .. } => {
                let row = collect_row::CollectRow::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CreateV2 { data, .. } => {
                let row = create_v2_row::CreateV2Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CreateCollectionV2 { data, .. } => {
                let row = create_collection_v2_row::CreateCollectionV2Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddExternalPluginAdapterV1 { data, .. } => {
                let row =
                    add_external_plugin_adapter_v1_row::AddExternalPluginAdapterV1Row::from_parts(
                        data.clone(),
                        metadata.clone(),
                        raw_accounts.clone(),
                    );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddCollectionExternalPluginAdapterV1 { data, .. } => {
                let row = add_collection_external_plugin_adapter_v1_row::AddCollectionExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveExternalPluginAdapterV1 { data, .. } => {
                let row = remove_external_plugin_adapter_v1_row::RemoveExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveCollectionExternalPluginAdapterV1 { data, .. } => {
                let row = remove_collection_external_plugin_adapter_v1_row::RemoveCollectionExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateExternalPluginAdapterV1 { data, .. } => {
                let row = update_external_plugin_adapter_v1_row::UpdateExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateCollectionExternalPluginAdapterV1 { data, .. } => {
                let row = update_collection_external_plugin_adapter_v1_row::UpdateCollectionExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::WriteExternalPluginAdapterDataV1 { data, .. } => {
                let row = write_external_plugin_adapter_data_v1_row::WriteExternalPluginAdapterDataV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::WriteCollectionExternalPluginAdapterDataV1 { data, .. } => {
                let row = write_collection_external_plugin_adapter_data_v1_row::WriteCollectionExternalPluginAdapterDataV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateV2 { data, .. } => {
                let row = update_v2_row::UpdateV2Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::ExecuteV1 { data, .. } => {
                let row = execute_v1_row::ExecuteV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateCollectionInfoV1 { data, .. } => {
                let row = update_collection_info_v1_row::UpdateCollectionInfoV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddCollectionsToGroupV1 { data, .. } => {
                let row = add_collections_to_group_v1_row::AddCollectionsToGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveCollectionsFromGroupV1 { data, .. } => {
                let row = remove_collections_from_group_v1_row::RemoveCollectionsFromGroupV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddAssetsToGroupV1 { data, .. } => {
                let row = add_assets_to_group_v1_row::AddAssetsToGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveAssetsFromGroupV1 { data, .. } => {
                let row = remove_assets_from_group_v1_row::RemoveAssetsFromGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddGroupsToGroupV1 { data, .. } => {
                let row = add_groups_to_group_v1_row::AddGroupsToGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveGroupsFromGroupV1 { data, .. } => {
                let row = remove_groups_from_group_v1_row::RemoveGroupsFromGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CreateGroupV1 { data, .. } => {
                let row = create_group_v1_row::CreateGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CloseGroupV1 { data, .. } => {
                let row = close_group_v1_row::CloseGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateGroupV1 { data, .. } => {
                let row = update_group_v1_row::UpdateGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.insert(pool).await?;
                Ok(())
            }
        }
    }
}

#[async_trait::async_trait]
impl carbon_core::postgres::operations::Upsert for MplCoreInstructionWithMetadata {
    async fn upsert(&self, pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
        let MplCoreInstructionWithMetadata(decoded_instruction, metadata, raw_accounts) = self;
        match decoded_instruction {
            MplCoreInstruction::CreateV1 { data, .. } => {
                let row = create_v1_row::CreateV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CreateCollectionV1 { data, .. } => {
                let row = create_collection_v1_row::CreateCollectionV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddPluginV1 { data, .. } => {
                let row = add_plugin_v1_row::AddPluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddCollectionPluginV1 { data, .. } => {
                let row = add_collection_plugin_v1_row::AddCollectionPluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemovePluginV1 { data, .. } => {
                let row = remove_plugin_v1_row::RemovePluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveCollectionPluginV1 { data, .. } => {
                let row = remove_collection_plugin_v1_row::RemoveCollectionPluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdatePluginV1 { data, .. } => {
                let row = update_plugin_v1_row::UpdatePluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateCollectionPluginV1 { data, .. } => {
                let row = update_collection_plugin_v1_row::UpdateCollectionPluginV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::ApprovePluginAuthorityV1 { data, .. } => {
                let row = approve_plugin_authority_v1_row::ApprovePluginAuthorityV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::ApproveCollectionPluginAuthorityV1 { data, .. } => {
                let row = approve_collection_plugin_authority_v1_row::ApproveCollectionPluginAuthorityV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RevokePluginAuthorityV1 { data, .. } => {
                let row = revoke_plugin_authority_v1_row::RevokePluginAuthorityV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RevokeCollectionPluginAuthorityV1 { data, .. } => {
                let row = revoke_collection_plugin_authority_v1_row::RevokeCollectionPluginAuthorityV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::BurnV1 { data, .. } => {
                let row = burn_v1_row::BurnV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::BurnCollectionV1 { data, .. } => {
                let row = burn_collection_v1_row::BurnCollectionV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::TransferV1 { data, .. } => {
                let row = transfer_v1_row::TransferV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateV1 { data, .. } => {
                let row = update_v1_row::UpdateV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateCollectionV1 { data, .. } => {
                let row = update_collection_v1_row::UpdateCollectionV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CompressV1 { data, .. } => {
                let row = compress_v1_row::CompressV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::DecompressV1 { data, .. } => {
                let row = decompress_v1_row::DecompressV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::Collect { data, .. } => {
                let row = collect_row::CollectRow::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CreateV2 { data, .. } => {
                let row = create_v2_row::CreateV2Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CreateCollectionV2 { data, .. } => {
                let row = create_collection_v2_row::CreateCollectionV2Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddExternalPluginAdapterV1 { data, .. } => {
                let row =
                    add_external_plugin_adapter_v1_row::AddExternalPluginAdapterV1Row::from_parts(
                        data.clone(),
                        metadata.clone(),
                        raw_accounts.clone(),
                    );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddCollectionExternalPluginAdapterV1 { data, .. } => {
                let row = add_collection_external_plugin_adapter_v1_row::AddCollectionExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveExternalPluginAdapterV1 { data, .. } => {
                let row = remove_external_plugin_adapter_v1_row::RemoveExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveCollectionExternalPluginAdapterV1 { data, .. } => {
                let row = remove_collection_external_plugin_adapter_v1_row::RemoveCollectionExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateExternalPluginAdapterV1 { data, .. } => {
                let row = update_external_plugin_adapter_v1_row::UpdateExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateCollectionExternalPluginAdapterV1 { data, .. } => {
                let row = update_collection_external_plugin_adapter_v1_row::UpdateCollectionExternalPluginAdapterV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::WriteExternalPluginAdapterDataV1 { data, .. } => {
                let row = write_external_plugin_adapter_data_v1_row::WriteExternalPluginAdapterDataV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::WriteCollectionExternalPluginAdapterDataV1 { data, .. } => {
                let row = write_collection_external_plugin_adapter_data_v1_row::WriteCollectionExternalPluginAdapterDataV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateV2 { data, .. } => {
                let row = update_v2_row::UpdateV2Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::ExecuteV1 { data, .. } => {
                let row = execute_v1_row::ExecuteV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateCollectionInfoV1 { data, .. } => {
                let row = update_collection_info_v1_row::UpdateCollectionInfoV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddCollectionsToGroupV1 { data, .. } => {
                let row = add_collections_to_group_v1_row::AddCollectionsToGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveCollectionsFromGroupV1 { data, .. } => {
                let row = remove_collections_from_group_v1_row::RemoveCollectionsFromGroupV1Row::from_parts(data.clone(), metadata.clone(), raw_accounts.clone());
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddAssetsToGroupV1 { data, .. } => {
                let row = add_assets_to_group_v1_row::AddAssetsToGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveAssetsFromGroupV1 { data, .. } => {
                let row = remove_assets_from_group_v1_row::RemoveAssetsFromGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::AddGroupsToGroupV1 { data, .. } => {
                let row = add_groups_to_group_v1_row::AddGroupsToGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::RemoveGroupsFromGroupV1 { data, .. } => {
                let row = remove_groups_from_group_v1_row::RemoveGroupsFromGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CreateGroupV1 { data, .. } => {
                let row = create_group_v1_row::CreateGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::CloseGroupV1 { data, .. } => {
                let row = close_group_v1_row::CloseGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
            MplCoreInstruction::UpdateGroupV1 { data, .. } => {
                let row = update_group_v1_row::UpdateGroupV1Row::from_parts(
                    data.clone(),
                    metadata.clone(),
                    raw_accounts.clone(),
                );
                row.upsert(pool).await?;
                Ok(())
            }
        }
    }
}
