Skip to content

Commit 16d27e4

Browse files
committed
fix test
1 parent 54288c3 commit 16d27e4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

internal/provider/branch_resource_migration.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ type branchResourceModelV0 struct {
178178
ShardCount types.Float64 `tfsdk:"shard_count"`
179179
Sharded types.Bool `tfsdk:"sharded"`
180180
UpdatedAt types.String `tfsdk:"updated_at"`
181+
SeedData types.String `tfsdk:"seed_data"`
181182
}
182183

183184
// branchSchemaV0 defines the schema for version 0.
@@ -279,6 +280,13 @@ func branchSchemaV0() *schema.Schema {
279280
Description: "When the branch was last updated.",
280281
Computed: true,
281282
},
283+
"seed_data": schema.StringAttribute{
284+
Description: "Seed data using the Data Branching® feature. Valid value is `last_successful_backup`",
285+
Optional: true,
286+
PlanModifiers: []planmodifier.String{
287+
stringplanmodifier.RequiresReplace(),
288+
},
289+
},
282290
},
283291
}
284292
}
@@ -312,6 +320,7 @@ func upgradeBranchStateV0toCurrent(ctx context.Context, req resource.UpgradeStat
312320
ShardCount: priorStateData.ShardCount,
313321
Sharded: priorStateData.Sharded,
314322
UpdatedAt: priorStateData.UpdatedAt,
323+
SeedData: priorStateData.SeedData,
315324
}
316325

317326
resp.Diagnostics.Append(resp.State.Set(ctx, upgradedStateData)...)

internal/provider/branch_resource_migration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func TestUpgradeBranchStateV0toCurrent(t *testing.T) {
4242
"shard_count": tftypes.NewValue(tftypes.Number, 1),
4343
"sharded": tftypes.NewValue(tftypes.Bool, false),
4444
"updated_at": tftypes.NewValue(tftypes.String, "2023-01-01T03:00:00Z"),
45+
"seed_data": tftypes.NewValue(tftypes.String, "last_successful_backup"),
4546
}),
4647
Schema: branchSchemaV0(),
4748
},
@@ -78,6 +79,7 @@ func TestUpgradeBranchStateV0toCurrent(t *testing.T) {
7879
"shard_count": tftypes.NewValue(tftypes.Number, 1),
7980
"sharded": tftypes.NewValue(tftypes.Bool, false),
8081
"updated_at": tftypes.NewValue(tftypes.String, "2023-01-01T03:00:00Z"),
82+
"seed_data": tftypes.NewValue(tftypes.String, "last_successful_backup"),
8183
}),
8284
Schema: branchSchemaV1(),
8385
},

0 commit comments

Comments
 (0)