From 07b671264d3d9a8e2681ff8b6a7719f02062f463 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Fri, 2 Jun 2023 10:12:13 -0700 Subject: [PATCH] Rename PNFT and regenerate Sea ORM types --- .../src/dao/generated/asset.rs | 3 + .../src/dao/generated/sea_orm_active_enums.rs | 100 +++++++++--------- .../src/m20230601_120101_add_pnft_enum_val.rs | 3 +- 3 files changed, 55 insertions(+), 51 deletions(-) diff --git a/digital_asset_types/src/dao/generated/asset.rs b/digital_asset_types/src/dao/generated/asset.rs index 0afb21fab..5f6b076c9 100644 --- a/digital_asset_types/src/dao/generated/asset.rs +++ b/digital_asset_types/src/dao/generated/asset.rs @@ -43,6 +43,7 @@ pub struct Model { pub slot_updated: i64, pub data_hash: Option, pub creator_hash: Option, + pub compressed_seq: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] @@ -72,6 +73,7 @@ pub enum Column { SlotUpdated, DataHash, CreatorHash, + CompressedSeq, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] @@ -124,6 +126,7 @@ impl ColumnTrait for Column { Self::SlotUpdated => ColumnType::BigInteger.def(), Self::DataHash => ColumnType::Char(Some(50u32)).def().null(), Self::CreatorHash => ColumnType::Char(Some(50u32)).def().null(), + Self::CompressedSeq => ColumnType::BigInteger.def().null(), } } } diff --git a/digital_asset_types/src/dao/generated/sea_orm_active_enums.rs b/digital_asset_types/src/dao/generated/sea_orm_active_enums.rs index 48fb34b5e..8d59f3296 100644 --- a/digital_asset_types/src/dao/generated/sea_orm_active_enums.rs +++ b/digital_asset_types/src/dao/generated/sea_orm_active_enums.rs @@ -7,17 +7,29 @@ use serde::{Deserialize, Serialize}; #[sea_orm( rs_type = "String", db_type = "Enum", - enum_name = "specification_versions" + enum_name = "v1_account_attachments" )] -pub enum SpecificationVersions { +pub enum V1AccountAttachments { + #[sea_orm(string_value = "edition")] + Edition, + #[sea_orm(string_value = "edition_marker")] + EditionMarker, + #[sea_orm(string_value = "master_edition_v1")] + MasterEditionV1, + #[sea_orm(string_value = "master_edition_v2")] + MasterEditionV2, + #[sea_orm(string_value = "unknown")] + Unknown, +} +#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "owner_type")] +pub enum OwnerType { + #[sea_orm(string_value = "single")] + Single, + #[sea_orm(string_value = "token")] + Token, #[sea_orm(string_value = "unknown")] Unknown, - #[sea_orm(string_value = "v0")] - V0, - #[sea_orm(string_value = "v1")] - V1, - #[sea_orm(string_value = "v2")] - V2, } #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] #[sea_orm( @@ -36,18 +48,6 @@ pub enum RoyaltyTargetType { Unknown, } #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] -#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "task_status")] -pub enum TaskStatus { - #[sea_orm(string_value = "failed")] - Failed, - #[sea_orm(string_value = "pending")] - Pending, - #[sea_orm(string_value = "running")] - Running, - #[sea_orm(string_value = "success")] - Success, -} -#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] #[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "chain_mutability")] pub enum ChainMutability { #[sea_orm(string_value = "immutable")] @@ -58,42 +58,32 @@ pub enum ChainMutability { Unknown, } #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] -#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "owner_type")] -pub enum OwnerType { - #[sea_orm(string_value = "single")] - Single, - #[sea_orm(string_value = "token")] - Token, - #[sea_orm(string_value = "unknown")] - Unknown, -} -#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] -#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "mutability")] -pub enum Mutability { - #[sea_orm(string_value = "immutable")] - Immutable, - #[sea_orm(string_value = "mutable")] - Mutable, - #[sea_orm(string_value = "unknown")] - Unknown, +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "task_status")] +pub enum TaskStatus { + #[sea_orm(string_value = "failed")] + Failed, + #[sea_orm(string_value = "pending")] + Pending, + #[sea_orm(string_value = "running")] + Running, + #[sea_orm(string_value = "success")] + Success, } #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] #[sea_orm( rs_type = "String", db_type = "Enum", - enum_name = "v1_account_attachments" + enum_name = "specification_versions" )] -pub enum V1AccountAttachments { - #[sea_orm(string_value = "edition")] - Edition, - #[sea_orm(string_value = "edition_marker")] - EditionMarker, - #[sea_orm(string_value = "master_edition_v1")] - MasterEditionV1, - #[sea_orm(string_value = "master_edition_v2")] - MasterEditionV2, +pub enum SpecificationVersions { #[sea_orm(string_value = "unknown")] Unknown, + #[sea_orm(string_value = "v0")] + V0, + #[sea_orm(string_value = "v1")] + V1, + #[sea_orm(string_value = "v2")] + V2, } #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] #[sea_orm( @@ -116,10 +106,20 @@ pub enum SpecificationAssetClass { Print, #[sea_orm(string_value = "PRINTABLE_NFT")] PrintableNft, + #[sea_orm(string_value = "PROGRAMMABLE_NFT")] + ProgrammableNft, #[sea_orm(string_value = "TRANSFER_RESTRICTED_NFT")] TransferRestrictedNft, #[sea_orm(string_value = "unknown")] Unknown, - #[sea_orm(string_value = "PNFT")] - ProgrammableNft, +} +#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "mutability")] +pub enum Mutability { + #[sea_orm(string_value = "immutable")] + Immutable, + #[sea_orm(string_value = "mutable")] + Mutable, + #[sea_orm(string_value = "unknown")] + Unknown, } diff --git a/migration/src/m20230601_120101_add_pnft_enum_val.rs b/migration/src/m20230601_120101_add_pnft_enum_val.rs index aa61c0c69..06fec368f 100644 --- a/migration/src/m20230601_120101_add_pnft_enum_val.rs +++ b/migration/src/m20230601_120101_add_pnft_enum_val.rs @@ -14,7 +14,8 @@ impl MigrationTrait for Migration { .get_connection() .execute(Statement::from_string( DatabaseBackend::Postgres, - "ALTER TYPE specification_asset_class ADD VALUE IF NOT EXISTS 'PNFT';".to_string(), + "ALTER TYPE specification_asset_class ADD VALUE IF NOT EXISTS 'PROGRAMMABLE_NFT';" + .to_string(), )) .await?;