Skip to content

Commit

Permalink
add prefix to tablename in models
Browse files Browse the repository at this point in the history
  • Loading branch information
BK1031 committed May 21, 2024
1 parent 874f956 commit 30e3340
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions model/route.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package model

import "time"
import (
"rincon/config"
"time"
)

type Route struct {
Route string `json:"route" gorm:"primaryKey"`
Expand All @@ -9,7 +12,7 @@ type Route struct {
}

func (Route) TableName() string {
return "route"
return config.DatabaseTablePrefix + "route"

Check warning on line 15 in model/route.go

View check run for this annotation

Codecov / codecov/patch

model/route.go#L15

Added line #L15 was not covered by tests
}

type RouteNode struct {
Expand Down
9 changes: 6 additions & 3 deletions model/service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package model

import "time"
import (
"rincon/config"
"time"
)

type Service struct {
ID int `json:"id" gorm:"primaryKey"`
Expand All @@ -13,7 +16,7 @@ type Service struct {
}

func (Service) TableName() string {
return "service"
return config.DatabaseTablePrefix + "service"

Check warning on line 19 in model/service.go

View check run for this annotation

Codecov / codecov/patch

model/service.go#L19

Added line #L19 was not covered by tests
}

type ServiceDependency struct {
Expand All @@ -25,5 +28,5 @@ type ServiceDependency struct {
}

func (ServiceDependency) TableName() string {
return "service_dependency"
return config.DatabaseTablePrefix + "service_dependency"

Check warning on line 31 in model/service.go

View check run for this annotation

Codecov / codecov/patch

model/service.go#L31

Added line #L31 was not covered by tests
}

0 comments on commit 30e3340

Please sign in to comment.