mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 13:35:23 +00:00
Do not apply the FK migrations on startup
This commit is contained in:
parent
d67be9ef58
commit
d8e0b16512
8
db.go
8
db.go
@ -50,9 +50,13 @@ func (h *Headscale) db() (*gorm.DB, error) {
|
|||||||
var err error
|
var err error
|
||||||
switch h.dbType {
|
switch h.dbType {
|
||||||
case "sqlite3":
|
case "sqlite3":
|
||||||
db, err = gorm.Open(sqlite.Open(h.dbString), &gorm.Config{})
|
db, err = gorm.Open(sqlite.Open(h.dbString), &gorm.Config{
|
||||||
|
DisableForeignKeyConstraintWhenMigrating: true,
|
||||||
|
})
|
||||||
case "postgres":
|
case "postgres":
|
||||||
db, err = gorm.Open(postgres.Open(h.dbString), &gorm.Config{})
|
db, err = gorm.Open(postgres.Open(h.dbString), &gorm.Config{
|
||||||
|
DisableForeignKeyConstraintWhenMigrating: true,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user