This is an automated email from the ASF dual-hosted git repository. abeizn pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit c1328967b5a80c1f1548eebfae284bfc6841e752 Author: abeizn <[email protected]> AuthorDate: Thu Jul 7 16:43:23 2022 +0800 fix: drop user table --- ...init_schema_20220615.go => init_schema_20220707.go} | 16 ++++++++-------- plugins/github/models/migrationscripts/register.go | 2 +- ...dateSchemas20220620.go => updateSchemas20220708.go} | 18 +++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/plugins/github/models/migrationscripts/init_schema_20220615.go b/plugins/github/models/migrationscripts/init_schema_20220707.go similarity index 91% rename from plugins/github/models/migrationscripts/init_schema_20220615.go rename to plugins/github/models/migrationscripts/init_schema_20220707.go index 19324401..c11853cf 100644 --- a/plugins/github/models/migrationscripts/init_schema_20220615.go +++ b/plugins/github/models/migrationscripts/init_schema_20220707.go @@ -28,7 +28,7 @@ import ( "gorm.io/gorm" ) -type GithubConnection20220615 struct { +type GithubConnection20220707 struct { commonArchived.Model Name string `gorm:"type:varchar(100);uniqueIndex" json:"name" validate:"required"` Endpoint string `mapstructure:"endpoint" env:"GITHUB_ENDPOINT" validate:"required"` @@ -37,7 +37,7 @@ type GithubConnection20220615 struct { Token string `mapstructure:"token" env:"GITHUB_AUTH" validate:"required" encrypt:"yes"` } -func (GithubConnection20220615) TableName() string { +func (GithubConnection20220707) TableName() string { return "_tool_github_connections" } @@ -50,8 +50,8 @@ func (u *initSchemas) SetConfigGetter(config core.ConfigGetter) { } func (u *initSchemas) Up(ctx context.Context, db *gorm.DB) error { - if db.Migrator().HasTable(GithubConnection20220615{}) { - err := db.Migrator().DropTable(GithubConnection20220615{}) + if db.Migrator().HasTable(GithubConnection20220707{}) { + err := db.Migrator().DropTable(GithubConnection20220707{}) if err != nil { return err } @@ -88,12 +88,12 @@ func (u *initSchemas) Up(ctx context.Context, db *gorm.DB) error { if err != nil { return err } - err = db.Migrator().CreateTable(GithubConnection20220615{}) + err = db.Migrator().CreateTable(GithubConnection20220707{}) if err != nil { return err } encodeKey := u.config.GetString(core.EncodeKeyEnvStr) - connection := &GithubConnection20220615{} + connection := &GithubConnection20220707{} connection.Endpoint = u.config.GetString(`GITHUB_ENDPOINT`) connection.Proxy = u.config.GetString(`GITHUB_PROXY`) connection.Token = u.config.GetString(`GITHUB_AUTH`) @@ -130,9 +130,9 @@ func (u *initSchemas) Up(ctx context.Context, db *gorm.DB) error { } func (*initSchemas) Version() uint64 { - return 20220615000001 + return 20220707000001 } func (*initSchemas) Name() string { - return "Github init schemas 20220611" + return "Github init schemas 20220707" } diff --git a/plugins/github/models/migrationscripts/register.go b/plugins/github/models/migrationscripts/register.go index e0b31a88..00159230 100644 --- a/plugins/github/models/migrationscripts/register.go +++ b/plugins/github/models/migrationscripts/register.go @@ -25,6 +25,6 @@ import ( func All() []migration.Script { return []migration.Script{ new(initSchemas), - new(UpdateSchemas20220620), + new(UpdateSchemas20220708), } } diff --git a/plugins/github/models/migrationscripts/updateSchemas20220620.go b/plugins/github/models/migrationscripts/updateSchemas20220708.go similarity index 79% rename from plugins/github/models/migrationscripts/updateSchemas20220620.go rename to plugins/github/models/migrationscripts/updateSchemas20220708.go index c5178cfa..4ef32a41 100644 --- a/plugins/github/models/migrationscripts/updateSchemas20220620.go +++ b/plugins/github/models/migrationscripts/updateSchemas20220708.go @@ -41,33 +41,33 @@ type GithubMilestone20220620 struct { ClosedAt time.Time } -// GithubIssue20220620 new field for models.GithubIssue -type GithubIssue20220620 struct { +// GithubIssue20220708 new field for models.GithubIssue +type GithubIssue20220708 struct { MilestoneId int } -type UpdateSchemas20220620 struct{} +type UpdateSchemas20220708 struct{} func (GithubMilestone20220620) TableName() string { return "_tool_github_milestones" } -func (GithubIssue20220620) TableName() string { +func (GithubIssue20220708) TableName() string { return "_tool_github_issues" } -func (*UpdateSchemas20220620) Up(_ context.Context, db *gorm.DB) error { - err := db.Migrator().AddColumn(GithubIssue20220620{}, "milestone_id") +func (*UpdateSchemas20220708) Up(_ context.Context, db *gorm.DB) error { + err := db.Migrator().AddColumn(GithubIssue20220708{}, "milestone_id") if err != nil { return err } return db.Migrator().CreateTable(GithubMilestone20220620{}) } -func (*UpdateSchemas20220620) Version() uint64 { - return 20220620000001 +func (*UpdateSchemas20220708) Version() uint64 { + return 20220708000001 } -func (*UpdateSchemas20220620) Name() string { +func (*UpdateSchemas20220708) Name() string { return "Add milestone for github" }
