-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes the association between Category and Tag table
This commit includes following changes - Modifies category and tag table - Add Migrations for category and tag table - Modifies category parsing logic from config file Signed-off-by: Shiv Verma <[email protected]>
- Loading branch information
1 parent
9106afc
commit 55c0dd8
Showing
8 changed files
with
77 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ type Data struct { | |
|
||
type Category struct { | ||
Name string | ||
Tags []string | ||
} | ||
|
||
type Catalog struct { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...kg/db/migration/202105311600_remove_categories_and_tag_association_from_category_table.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright © 2021 The Tekton Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package migration | ||
|
||
import ( | ||
"github.com/go-gormigrate/gormigrate/v2" | ||
"github.com/tektoncd/hub/api/gen/log" | ||
"github.com/tektoncd/hub/api/pkg/db/model" | ||
"gorm.io/gorm" | ||
) | ||
|
||
func removeCatgoryAndTagAssociation(log *log.Logger) *gormigrate.Migration { | ||
|
||
return &gormigrate.Migration{ | ||
ID: "202105311600_remove_categories_and_tag_association_from_category_table", | ||
Migrate: func(db *gorm.DB) error { | ||
if err := db.AutoMigrate(&model.Category{}); err != nil { | ||
log.Error(err) | ||
return err | ||
} | ||
return nil | ||
}, | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
api/pkg/db/migration/202105311800_remove_categoryid_column_from_tag_table.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright © 2021 The Tekton Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package migration | ||
|
||
import ( | ||
"github.com/go-gormigrate/gormigrate/v2" | ||
"github.com/tektoncd/hub/api/gen/log" | ||
"github.com/tektoncd/hub/api/pkg/db/model" | ||
"gorm.io/gorm" | ||
) | ||
|
||
func removeCatgoryIdFromTagtable(log *log.Logger) *gormigrate.Migration { | ||
|
||
return &gormigrate.Migration{ | ||
ID: "202105311800_remove_categoryid_column_from_tag_table.go", | ||
Migrate: func(db *gorm.DB) error { | ||
if err := db.AutoMigrate(&model.Tag{}); err != nil { | ||
log.Error(err) | ||
return err | ||
} | ||
return nil | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters