From 709d6011ff882dc26140c4e8d1cb9fe8c2f2078b Mon Sep 17 00:00:00 2001 From: elraphty Date: Fri, 26 Apr 2024 13:30:54 +0100 Subject: [PATCH] fixed migration org uuid --- .github/workflows/docker-build-on-master.yml | 9 +++------ .github/workflows/frontend-e2e.yml | 2 +- .github/workflows/prjob_tests.yml | 2 +- db/config.go | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build-on-master.yml b/.github/workflows/docker-build-on-master.yml index df0cb0219..8bba45a8f 100644 --- a/.github/workflows/docker-build-on-master.yml +++ b/.github/workflows/docker-build-on-master.yml @@ -4,13 +4,13 @@ env: on: push: - branch: - - master + branches: + - master jobs: build: runs-on: ubuntu-20.04 - name: Build and push Tribes image + name: Build and push Tribes image env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true steps: @@ -44,6 +44,3 @@ jobs: --platform linux/amd64,linux/arm64,linux/arm/v7 \ --tag "${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes:master" \ --output "type=registry" ./ - - - diff --git a/.github/workflows/frontend-e2e.yml b/.github/workflows/frontend-e2e.yml index d284d6a53..36675e00b 100644 --- a/.github/workflows/frontend-e2e.yml +++ b/.github/workflows/frontend-e2e.yml @@ -2,7 +2,7 @@ name: Cypress Frontend E2E tests on: pull_request: branches: - - master + - "*" jobs: cypress-run: diff --git a/.github/workflows/prjob_tests.yml b/.github/workflows/prjob_tests.yml index 810e6a84e..38a579912 100644 --- a/.github/workflows/prjob_tests.yml +++ b/.github/workflows/prjob_tests.yml @@ -2,7 +2,7 @@ name: Tests on: pull_request: branches: - - master + - "*" jobs: test-go: name: Go diff --git a/db/config.go b/db/config.go index 9789078b9..f635fa4ef 100644 --- a/db/config.go +++ b/db/config.go @@ -177,6 +177,8 @@ func (db database) MigrateTablesWithOrgUuid() { if !db.db.Migrator().HasTable("bounty") { if !db.db.Migrator().HasColumn(Bounty{}, "workspace_uuid") { db.db.AutoMigrate(&Bounty{}) + } else { + db.db.AutoMigrate(&NewBounty{}) } } if !db.db.Migrator().HasTable("budget_histories") { @@ -187,28 +189,40 @@ func (db database) MigrateTablesWithOrgUuid() { if !db.db.Migrator().HasTable("payment_histories") { if !db.db.Migrator().HasColumn(PaymentHistory{}, "workspace_uuid") { db.db.AutoMigrate(&PaymentHistory{}) + } else { + db.db.AutoMigrate(&NewPaymentHistory{}) } } if !db.db.Migrator().HasTable("invoice_list") { if !db.db.Migrator().HasColumn(InvoiceList{}, "workspace_uuid") { db.db.AutoMigrate(&InvoiceList{}) + } else { + db.db.AutoMigrate(&NewInvoiceList{}) } } if !db.db.Migrator().HasTable("bounty_budgets") { if !db.db.Migrator().HasColumn(BountyBudget{}, "workspace_uuid") { db.db.AutoMigrate(&BountyBudget{}) + } else { + db.db.AutoMigrate(&NewBountyBudget{}) } } if !db.db.Migrator().HasTable("workspace_user_roles") { if !db.db.Migrator().HasColumn(UserRoles{}, "workspace_uuid") { db.db.AutoMigrate(&UserRoles{}) } + } else { + db.db.AutoMigrate(&WorkspaceUserRoles{}) } if !db.db.Migrator().HasTable("workspaces") { db.db.AutoMigrate(&Organization{}) + } else { + db.db.AutoMigrate(&Workspace{}) } if !db.db.Migrator().HasTable("workspace_users") { db.db.AutoMigrate(&OrganizationUsers{}) + } else { + db.db.AutoMigrate(&WorkspaceUsers{}) } }