重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/dojoengine/book --skill dojo-migrate处理已部署 Dojo 世界更新时的世界迁移、升级和破坏性变更。
管理迁移工作流:
更新现有世界:
"将我的变更迁移到已部署的世界"
版本升级:
"将我的项目升级到 Dojo v1.8.0"
sozo inspect
显示:
sozo build
sozo test
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 使用默认的 dev 配置文件部署
sozo migrate
# 使用特定的配置文件部署
sozo migrate --profile sepolia
添加新模型:
// 新模型 - 可以安全添加
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct NewFeature {
#[key]
pub player: ContractAddress,
pub data: u32,
}
添加新系统:
// 新系统 - 可以安全添加
#[dojo::contract]
pub mod new_system {
// 实现
}
添加模型字段:
// 添加字段 - 现有数据将具有默认(零)值
struct Position {
#[key] player: ContractAddress,
x: u32,
y: u32,
z: u32, // 新字段
}
更改关键字段:
// 旧版本
struct Position {
#[key] player: ContractAddress,
x: u32, y: u32,
}
// 新版本 - 破坏性变更!不同的键结构
struct Position {
#[key] entity_id: u32, // 更改了键
x: u32, y: u32,
}
移除字段:
// 旧版本
struct Stats {
#[key] player: ContractAddress,
health: u8,
mana: u8,
}
// 新版本 - 破坏性变更!数据丢失
struct Stats {
#[key] player: ContractAddress,
health: u8,
// mana 被移除
}
更改字段类型:
// 旧版本
struct Position {
#[key] player: ContractAddress,
x: u32,
y: u32,
}
// 新版本 - 破坏性变更!类型不兼容
struct Position {
#[key] player: ContractAddress,
x: u128, // 更改了类型
y: u128,
}
使用不同的种子部署全新的世界:
# dojo_dev.toml
[world]
seed = "my_game_v2" # 不同的种子 = 新的世界地址
sozo build && sozo migrate
同时保留旧版本和新版本:
// 保留旧模型
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct PositionV1 {
#[key] player: ContractAddress,
x: u32, y: u32,
}
// 添加新模型
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct PositionV2 {
#[key] entity_id: u32,
x: u32, y: u32, z: u32,
}
创建一个迁移系统来转换数据:
#[dojo::contract]
pub mod migrator {
fn migrate_positions(ref self: ContractState, players: Array<ContractAddress>) {
let mut world = self.world_default();
for player in players {
// 读取旧格式
let old_pos: PositionV1 = world.read_model(player);
// 转换为新格式
let new_pos = PositionV2 {
entity_id: world.uuid(),
x: old_pos.x,
y: old_pos.y,
z: 0,
};
// 写入新格式
world.write_model(@new_pos);
}
}
}
Scarb.toml:[dependencies]
dojo = "1.8.0"
[dev-dependencies]
dojo_cairo_test = "1.8.0"
2. 查看变更日志以了解破坏性变更
sozo build
sozo test
4. 迁移:
sozo migrate
sozo inspect 审查变更sozo build)sozo test)sozo migrate)# 1. 将模型添加到代码中
# 2. 构建
sozo build
# 3. 迁移
sozo migrate
# 4. 验证
sozo inspect
# 1. 更新系统代码
# 2. 构建和测试
sozo build
sozo test
# 3. 迁移(重新部署系统)
sozo migrate
# 4. 测试更新后的系统
sozo execute my_game-actions spawn
sozo buildtarget/ 目录并重新构建sozo inspect 的输出迁移后:
sozo build --typescript)dojo-indexer 技能)每周安装次数
64
代码仓库
GitHub 星标数
53
首次出现
2026年1月30日
安全审计
安装于
opencode61
codex60
kimi-cli59
gemini-cli59
cursor59
github-copilot58
Handle world migrations, upgrades, and breaking changes when updating deployed Dojo worlds.
Manages migration workflows:
Update existing world:
"Migrate my changes to the deployed world"
Version upgrade:
"Upgrade my project to Dojo v1.8.0"
sozo inspect
Shows:
sozo build
sozo test
# Deploy with default dev profile
sozo migrate
# Deploy with specific profile
sozo migrate --profile sepolia
Adding new model:
// New model - safe to add
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct NewFeature {
#[key]
pub player: ContractAddress,
pub data: u32,
}
Adding new system:
// New system - safe to add
#[dojo::contract]
pub mod new_system {
// Implementation
}
Adding model field:
// Adding field - existing data will have default (zero) value
struct Position {
#[key] player: ContractAddress,
x: u32,
y: u32,
z: u32, // New field
}
Changing key fields:
// Old
struct Position {
#[key] player: ContractAddress,
x: u32, y: u32,
}
// New - BREAKING! Different key structure
struct Position {
#[key] entity_id: u32, // Changed key
x: u32, y: u32,
}
Removing fields:
// Old
struct Stats {
#[key] player: ContractAddress,
health: u8,
mana: u8,
}
// New - BREAKING! Data loss
struct Stats {
#[key] player: ContractAddress,
health: u8,
// mana removed
}
Changing field types:
// Old
struct Position {
#[key] player: ContractAddress,
x: u32,
y: u32,
}
// New - BREAKING! Type incompatible
struct Position {
#[key] player: ContractAddress,
x: u128, // Changed type
y: u128,
}
Deploy fresh world with different seed:
# dojo_dev.toml
[world]
seed = "my_game_v2" # Different seed = new world address
sozo build && sozo migrate
Keep both old and new versions:
// Keep old model
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct PositionV1 {
#[key] player: ContractAddress,
x: u32, y: u32,
}
// Add new model
#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct PositionV2 {
#[key] entity_id: u32,
x: u32, y: u32, z: u32,
}
Create a migration system to transform data:
#[dojo::contract]
pub mod migrator {
fn migrate_positions(ref self: ContractState, players: Array<ContractAddress>) {
let mut world = self.world_default();
for player in players {
// Read old format
let old_pos: PositionV1 = world.read_model(player);
// Transform to new format
let new_pos = PositionV2 {
entity_id: world.uuid(),
x: old_pos.x,
y: old_pos.y,
z: 0,
};
// Write new format
world.write_model(@new_pos);
}
}
}
Scarb.toml:[dependencies]
dojo = "1.8.0"
[dev-dependencies]
dojo_cairo_test = "1.8.0"
2. Review changelog for breaking changes
sozo build
sozo test
4. Migrate:
sozo migrate
sozo inspectsozo build)sozo test)sozo migrate)# 1. Add model to code
# 2. Build
sozo build
# 3. Migrate
sozo migrate
# 4. Verify
sozo inspect
# 1. Update system code
# 2. Build and test
sozo build
sozo test
# 3. Migrate (redeploys system)
sozo migrate
# 4. Test updated system
sozo execute my_game-actions spawn
sozo build firsttarget/ directory and rebuildsozo inspect outputAfter migration:
sozo build --typescript)dojo-indexer skill)Weekly Installs
64
Repository
GitHub Stars
53
First Seen
Jan 30, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode61
codex60
kimi-cli59
gemini-cli59
cursor59
github-copilot58
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
158,400 周安装
Play.fun 游戏集成技能 - 官方API、SDK与部署指南 | OpusGameLabs
102 周安装
shadcn组件发现工具:在1500+组件库中搜索,避免重复造轮子
108 周安装
Apple HIG项目上下文技能:自动收集iOS/macOS应用设计开发信息
106 周安装
Apple HIG 状态组件设计指南:进度条、旋转器、活动圆环最佳实践
105 周安装
Apple HIG 内容组件指南:图表、集合、图像视图等组件选择与优化
104 周安装
YouTube数据分析技能 - 使用YouTube API v3进行频道分析、视频表现评估与SEO优化
106 周安装