mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-20 23:46:49 +00:00
Drop old columns (#1838)
This commit is contained in:
parent
7e708874ae
commit
5d74174bc3
11 changed files with 45 additions and 35 deletions
|
@ -3933,10 +3933,6 @@ const docTemplate = `{
|
||||||
"description": "uses reported user for webhooks and name of cron for cron pipelines",
|
"description": "uses reported user for webhooks and name of cron for cron pipelines",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"signed": {
|
|
||||||
"description": "deprecate",
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"started_at": {
|
"started_at": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
@ -3963,10 +3959,6 @@ const docTemplate = `{
|
||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"verified": {
|
|
||||||
"description": "deprecate",
|
|
||||||
"type": "boolean"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -4230,9 +4222,6 @@ const docTemplate = `{
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"pgid": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"pid": {
|
"pid": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
|
|
@ -83,7 +83,6 @@ func (b *StepBuilder) Build() ([]*Item, error) {
|
||||||
UUID: uuid.New().String(), // TODO(#1784): Remove once workflows are a separate entity in database
|
UUID: uuid.New().String(), // TODO(#1784): Remove once workflows are a separate entity in database
|
||||||
PipelineID: b.Curr.ID,
|
PipelineID: b.Curr.ID,
|
||||||
PID: pidSequence,
|
PID: pidSequence,
|
||||||
PGID: pidSequence,
|
|
||||||
State: model.StatusPending,
|
State: model.StatusPending,
|
||||||
Environ: axis,
|
Environ: axis,
|
||||||
Name: SanitizePath(y.Name),
|
Name: SanitizePath(y.Name),
|
||||||
|
@ -305,7 +304,6 @@ func SetPipelineStepsOnPipeline(pipeline *model.Pipeline, pipelineItems []*Item)
|
||||||
PipelineID: pipeline.ID,
|
PipelineID: pipeline.ID,
|
||||||
PID: pidSequence,
|
PID: pidSequence,
|
||||||
PPID: item.Workflow.PID,
|
PPID: item.Workflow.PID,
|
||||||
PGID: gid,
|
|
||||||
State: model.StatusPending,
|
State: model.StatusPending,
|
||||||
}
|
}
|
||||||
if item.Workflow.State == model.StatusSkipped {
|
if item.Workflow.State == model.StatusSkipped {
|
||||||
|
|
|
@ -43,8 +43,6 @@ type Pipeline struct {
|
||||||
Avatar string `json:"author_avatar" xorm:"pipeline_avatar"`
|
Avatar string `json:"author_avatar" xorm:"pipeline_avatar"`
|
||||||
Email string `json:"author_email" xorm:"pipeline_email"`
|
Email string `json:"author_email" xorm:"pipeline_email"`
|
||||||
Link string `json:"link_url" xorm:"pipeline_link"`
|
Link string `json:"link_url" xorm:"pipeline_link"`
|
||||||
Signed bool `json:"signed" xorm:"pipeline_signed"` // deprecate
|
|
||||||
Verified bool `json:"verified" xorm:"pipeline_verified"` // deprecate
|
|
||||||
Reviewer string `json:"reviewed_by" xorm:"pipeline_reviewer"`
|
Reviewer string `json:"reviewed_by" xorm:"pipeline_reviewer"`
|
||||||
Reviewed int64 `json:"reviewed_at" xorm:"pipeline_reviewed"`
|
Reviewed int64 `json:"reviewed_at" xorm:"pipeline_reviewed"`
|
||||||
Steps []*Step `json:"steps,omitempty" xorm:"-"`
|
Steps []*Step `json:"steps,omitempty" xorm:"-"`
|
||||||
|
|
|
@ -35,7 +35,6 @@ type Step struct {
|
||||||
PipelineID int64 `json:"pipeline_id" xorm:"UNIQUE(s) INDEX 'step_pipeline_id'"`
|
PipelineID int64 `json:"pipeline_id" xorm:"UNIQUE(s) INDEX 'step_pipeline_id'"`
|
||||||
PID int `json:"pid" xorm:"UNIQUE(s) 'step_pid'"`
|
PID int `json:"pid" xorm:"UNIQUE(s) 'step_pid'"`
|
||||||
PPID int `json:"ppid" xorm:"step_ppid"`
|
PPID int `json:"ppid" xorm:"step_ppid"`
|
||||||
PGID int `json:"pgid" xorm:"step_pgid"`
|
|
||||||
Name string `json:"name" xorm:"step_name"`
|
Name string `json:"name" xorm:"step_name"`
|
||||||
State StatusValue `json:"state" xorm:"step_state"`
|
State StatusValue `json:"state" xorm:"step_state"`
|
||||||
Error string `json:"error,omitempty" xorm:"VARCHAR(500) step_error"`
|
Error string `json:"error,omitempty" xorm:"VARCHAR(500) step_error"`
|
||||||
|
|
|
@ -27,7 +27,6 @@ func TestTree(t *testing.T) {
|
||||||
PID: 2,
|
PID: 2,
|
||||||
PipelineID: 6,
|
PipelineID: 6,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 2,
|
|
||||||
Name: "clone",
|
Name: "clone",
|
||||||
State: StatusSuccess,
|
State: StatusSuccess,
|
||||||
Error: "0",
|
Error: "0",
|
||||||
|
@ -37,7 +36,6 @@ func TestTree(t *testing.T) {
|
||||||
PipelineID: 6,
|
PipelineID: 6,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 0,
|
PPID: 0,
|
||||||
PGID: 1,
|
|
||||||
Name: "lint",
|
Name: "lint",
|
||||||
State: StatusFailure,
|
State: StatusFailure,
|
||||||
Error: "1",
|
Error: "1",
|
||||||
|
@ -47,7 +45,6 @@ func TestTree(t *testing.T) {
|
||||||
PipelineID: 6,
|
PipelineID: 6,
|
||||||
PID: 3,
|
PID: 3,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 3,
|
|
||||||
Name: "lint",
|
Name: "lint",
|
||||||
State: StatusFailure,
|
State: StatusFailure,
|
||||||
Error: "1",
|
Error: "1",
|
||||||
|
@ -63,7 +60,6 @@ func TestTree(t *testing.T) {
|
||||||
PID: 2,
|
PID: 2,
|
||||||
PipelineID: 6,
|
PipelineID: 6,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 2,
|
|
||||||
Name: "clone",
|
Name: "clone",
|
||||||
State: StatusSuccess,
|
State: StatusSuccess,
|
||||||
Error: "0",
|
Error: "0",
|
||||||
|
|
|
@ -81,7 +81,6 @@ func Create(ctx context.Context, _store store.Store, repo *model.Repo, pipeline
|
||||||
|
|
||||||
// update some pipeline fields
|
// update some pipeline fields
|
||||||
pipeline.RepoID = repo.ID
|
pipeline.RepoID = repo.ID
|
||||||
pipeline.Verified = true
|
|
||||||
pipeline.Status = model.StatusPending
|
pipeline.Status = model.StatusPending
|
||||||
|
|
||||||
if configFetchErr != nil {
|
if configFetchErr != nil {
|
||||||
|
|
44
server/store/datastore/migration/018_drop_old_cols.go
Normal file
44
server/store/datastore/migration/018_drop_old_cols.go
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// Copyright 2023 Woodpecker 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 (
|
||||||
|
"xorm.io/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type oldPipeline018 struct {
|
||||||
|
ID int64 `xorm:"pk autoincr 'pipeline_id'"`
|
||||||
|
Signed bool `xorm:"pipeline_signed"`
|
||||||
|
Verified bool `xorm:"pipeline_verified"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (oldPipeline018) TableName() string {
|
||||||
|
return "pipelines"
|
||||||
|
}
|
||||||
|
|
||||||
|
var dropOldCols = task{
|
||||||
|
name: "drop-old-col",
|
||||||
|
fn: func(sess *xorm.Session) error {
|
||||||
|
// make sure columns on pipelines exist
|
||||||
|
if err := sess.Sync(new(oldPipeline018)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := dropTableColumns(sess, "steps", "step_pgid"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return dropTableColumns(sess, "pipelines", "pipeline_signed", "pipeline_verified")
|
||||||
|
},
|
||||||
|
}
|
|
@ -47,6 +47,7 @@ var migrationTasks = []*task{
|
||||||
&removeInactiveRepos,
|
&removeInactiveRepos,
|
||||||
&dropFiles,
|
&dropFiles,
|
||||||
&removeMachineCol,
|
&removeMachineCol,
|
||||||
|
&dropOldCols,
|
||||||
}
|
}
|
||||||
|
|
||||||
var allBeans = []interface{}{
|
var allBeans = []interface{}{
|
||||||
|
|
|
@ -34,7 +34,6 @@ func TestStepFind(t *testing.T) {
|
||||||
PipelineID: 1000,
|
PipelineID: 1000,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 2,
|
PPID: 2,
|
||||||
PGID: 3,
|
|
||||||
Name: "build",
|
Name: "build",
|
||||||
State: model.StatusSuccess,
|
State: model.StatusSuccess,
|
||||||
Error: "pc load letter",
|
Error: "pc load letter",
|
||||||
|
@ -65,14 +64,12 @@ func TestStepChild(t *testing.T) {
|
||||||
PipelineID: 1,
|
PipelineID: 1,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 1,
|
|
||||||
State: "success",
|
State: "success",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
UUID: "2bf387f7-2913-4907-814c-c9ada88707c0",
|
UUID: "2bf387f7-2913-4907-814c-c9ada88707c0",
|
||||||
PipelineID: 1,
|
PipelineID: 1,
|
||||||
PID: 2,
|
PID: 2,
|
||||||
PGID: 2,
|
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
Name: "build",
|
Name: "build",
|
||||||
State: "success",
|
State: "success",
|
||||||
|
@ -106,7 +103,6 @@ func TestStepList(t *testing.T) {
|
||||||
PipelineID: 2,
|
PipelineID: 2,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 1,
|
|
||||||
State: "success",
|
State: "success",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -114,14 +110,12 @@ func TestStepList(t *testing.T) {
|
||||||
PipelineID: 1,
|
PipelineID: 1,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 1,
|
|
||||||
State: "success",
|
State: "success",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
UUID: "40aab045-970b-4892-b6df-6f825a7ec97a",
|
UUID: "40aab045-970b-4892-b6df-6f825a7ec97a",
|
||||||
PipelineID: 1,
|
PipelineID: 1,
|
||||||
PID: 2,
|
PID: 2,
|
||||||
PGID: 2,
|
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
Name: "build",
|
Name: "build",
|
||||||
State: "success",
|
State: "success",
|
||||||
|
@ -150,7 +144,6 @@ func TestStepUpdate(t *testing.T) {
|
||||||
PipelineID: 1,
|
PipelineID: 1,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 2,
|
PPID: 2,
|
||||||
PGID: 3,
|
|
||||||
Name: "build",
|
Name: "build",
|
||||||
State: "pending",
|
State: "pending",
|
||||||
Error: "pc load letter",
|
Error: "pc load letter",
|
||||||
|
@ -188,7 +181,6 @@ func TestStepIndexes(t *testing.T) {
|
||||||
PipelineID: 1,
|
PipelineID: 1,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 1,
|
|
||||||
State: "running",
|
State: "running",
|
||||||
Name: "build",
|
Name: "build",
|
||||||
},
|
},
|
||||||
|
@ -204,7 +196,6 @@ func TestStepIndexes(t *testing.T) {
|
||||||
PipelineID: 1,
|
PipelineID: 1,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 1,
|
|
||||||
State: "success",
|
State: "success",
|
||||||
Name: "clone",
|
Name: "clone",
|
||||||
},
|
},
|
||||||
|
@ -219,7 +210,6 @@ func TestStepIndexes(t *testing.T) {
|
||||||
PipelineID: 5,
|
PipelineID: 5,
|
||||||
PID: 4,
|
PID: 4,
|
||||||
PPID: 3,
|
PPID: 3,
|
||||||
PGID: 2,
|
|
||||||
State: "success",
|
State: "success",
|
||||||
Name: "clone",
|
Name: "clone",
|
||||||
},
|
},
|
||||||
|
@ -238,7 +228,6 @@ func TestStepByUUID(t *testing.T) {
|
||||||
PipelineID: 1,
|
PipelineID: 1,
|
||||||
PID: 1,
|
PID: 1,
|
||||||
PPID: 1,
|
PPID: 1,
|
||||||
PGID: 1,
|
|
||||||
State: "running",
|
State: "running",
|
||||||
Name: "build",
|
Name: "build",
|
||||||
},
|
},
|
||||||
|
@ -247,7 +236,6 @@ func TestStepByUUID(t *testing.T) {
|
||||||
PipelineID: 4,
|
PipelineID: 4,
|
||||||
PID: 6,
|
PID: 6,
|
||||||
PPID: 7,
|
PPID: 7,
|
||||||
PGID: 8,
|
|
||||||
Name: "build",
|
Name: "build",
|
||||||
State: "pending",
|
State: "pending",
|
||||||
Error: "pc load letter",
|
Error: "pc load letter",
|
||||||
|
|
|
@ -106,7 +106,6 @@ export type PipelineStep = {
|
||||||
pipeline_id: number;
|
pipeline_id: number;
|
||||||
pid: number;
|
pid: number;
|
||||||
ppid: number;
|
ppid: number;
|
||||||
pgid: number;
|
|
||||||
name: string;
|
name: string;
|
||||||
state: PipelineStatus;
|
state: PipelineStatus;
|
||||||
exit_code: number;
|
exit_code: number;
|
||||||
|
|
|
@ -93,7 +93,6 @@ type (
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
PID int `json:"pid"`
|
PID int `json:"pid"`
|
||||||
PPID int `json:"ppid"`
|
PPID int `json:"ppid"`
|
||||||
PGID int `json:"pgid"`
|
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
Error string `json:"error,omitempty"`
|
Error string `json:"error,omitempty"`
|
||||||
|
|
Loading…
Reference in a new issue