Skip to content

Commit

Permalink
adds ForceNew on sequence db, schema & name
Browse files Browse the repository at this point in the history
  • Loading branch information
jtzero committed Jan 30, 2022
1 parent acc9c36 commit 907b57c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions pkg/resources/sequence.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var sequenceSchema = map[string]*schema.Schema{
Type: schema.TypeString,
Required: true,
Description: "Specifies the name for the sequence.",
ForceNew: true,
},
"comment": {
Type: schema.TypeString,
Expand All @@ -40,11 +41,13 @@ var sequenceSchema = map[string]*schema.Schema{
Type: schema.TypeString,
Required: true,
Description: "The database in which to create the sequence. Don't use the | character.",
ForceNew: true,
},
"schema": {
Type: schema.TypeString,
Required: true,
Description: "The schema in which to create the sequence. Don't use the | character.",
ForceNew: true,
},
"next_value": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -206,12 +209,7 @@ func ReadSequence(d *schema.ResourceData, meta interface{}) error {
return err
}

d.SetId(fmt.Sprintf(`%v|%v|%v`, sequence.DBName.String, sequence.SchemaName.String, sequence.Name.String))
if err != nil {
return err
}

return err
return nil
}

func UpdateSequence(d *schema.ResourceData, meta interface{}) error {
Expand Down
1 change: 0 additions & 1 deletion pkg/resources/sequence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ func TestSequenceRead(t *testing.T) {
r.Equal("database", d.Get("database").(string))
r.Equal("mock comment", d.Get("comment").(string))
r.Equal(25, d.Get("increment").(int))
r.Equal(5, d.Get("next_value").(int))
r.Equal("database|schema|good_name", d.Id())
r.Equal(`"database"."schema"."good_name"`, d.Get("fully_qualified_name").(string))
})
Expand Down

0 comments on commit 907b57c

Please sign in to comment.