Skip to content

Commit

Permalink
fixed migration org uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Apr 26, 2024
1 parent 7667276 commit 709d601
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/docker-build-on-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -44,6 +44,3 @@ jobs:
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--tag "${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes:master" \
--output "type=registry" ./
2 changes: 1 addition & 1 deletion .github/workflows/frontend-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Cypress Frontend E2E tests
on:
pull_request:
branches:
- master
- "*"

jobs:
cypress-run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prjob_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Tests
on:
pull_request:
branches:
- master
- "*"
jobs:
test-go:
name: Go
Expand Down
14 changes: 14 additions & 0 deletions db/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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{})
}
}

Expand Down

0 comments on commit 709d601

Please sign in to comment.