Skip to content

Commit

Permalink
Rename PNFT and regenerate Sea ORM types
Browse files Browse the repository at this point in the history
  • Loading branch information
danenbm committed Jun 2, 2023
1 parent 634030d commit 07b6712
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 51 deletions.
3 changes: 3 additions & 0 deletions digital_asset_types/src/dao/generated/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub struct Model {
pub slot_updated: i64,
pub data_hash: Option<String>,
pub creator_hash: Option<String>,
pub compressed_seq: Option<i64>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
Expand Down Expand Up @@ -72,6 +73,7 @@ pub enum Column {
SlotUpdated,
DataHash,
CreatorHash,
CompressedSeq,
}

#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
Expand Down Expand Up @@ -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(),
}
}
}
Expand Down
100 changes: 50 additions & 50 deletions digital_asset_types/src/dao/generated/sea_orm_active_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")]
Expand All @@ -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(
Expand All @@ -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,
}
3 changes: 2 additions & 1 deletion migration/src/m20230601_120101_add_pnft_enum_val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;

Expand Down

0 comments on commit 07b6712

Please sign in to comment.