Skip to content

Commit

Permalink
feat: add plan db scheme (#164)
Browse files Browse the repository at this point in the history
* feat: add plan type with db gorm scheme

* style: fix revive naming issues

* feat: add plan to auto-migrate + add version_id to plan model

* feat: add lineage field to plan model

* feat: remove ResourceUpdated & ResourcesNooped fields to plan model
* fix CiURL field json tag

* feat: remove Version Belongs To relation from Plan

* feat: ORM model for plan json parsing to db
* added varchar(10) constraint to State TFVersion
* replaced CreatedAt/UpdatedAt

* fix: add missing foreign key colomn in PlanStateResource model
  • Loading branch information
hbollon committed Jun 16, 2021
1 parent 1165c06 commit 2c1cd8f
Show file tree
Hide file tree
Showing 6 changed files with 727 additions and 2 deletions.
13 changes: 13 additions & 0 deletions db/db.go
Expand Up @@ -54,6 +54,19 @@ func Init(config config.DBConfig, debug bool) *Database {
&types.Resource{},
&types.Attribute{},
&types.OutputValue{},
&types.Plan{},
&types.PlanModel{},
&types.PlanModelVariable{},
&types.PlanOutput{},
&types.PlanOutputChange{},
&types.PlanResourceChange{},
&types.PlanState{},
&types.PlanStateModule{},
&types.PlanStateOutput{},
&types.PlanStateResource{},
&types.PlanStateResourceAttribute{},
&types.PlanStateValue{},
&types.Change{},
)

if debug {
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Expand Up @@ -18,7 +18,7 @@ require (
github.com/lib/pq v1.9.0 // indirect
github.com/machinebox/graphql v0.2.2
github.com/matryer/is v1.4.0 // indirect
github.com/mitchellh/copystructure v1.1.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0
github.com/sirupsen/logrus v1.7.0
Expand All @@ -29,4 +29,5 @@ require (
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
google.golang.org/api v0.38.0
gopkg.in/yaml.v2 v2.4.0
gorm.io/datatypes v1.0.1
)

0 comments on commit 2c1cd8f

Please sign in to comment.