mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix: site and stream unique ke y create issue #1017
This commit is contained in:
parent
7c791f3784
commit
fbc800ff22
1 changed files with 23 additions and 21 deletions
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var FixSiteAndStreamPathUnique = &gormigrate.Migration{
|
var FixSiteAndStreamPathUnique = &gormigrate.Migration{
|
||||||
ID: "20250405000003",
|
ID: "202505070000001",
|
||||||
Migrate: func(tx *gorm.DB) error {
|
Migrate: func(tx *gorm.DB) error {
|
||||||
// Check if sites table exists
|
// Check if sites table exists
|
||||||
if tx.Migrator().HasTable(&model.Site{}) {
|
if tx.Migrator().HasTable(&model.Site{}) {
|
||||||
|
@ -21,6 +21,7 @@ var FixSiteAndStreamPathUnique = &gormigrate.Migration{
|
||||||
Select("path, count(*) as count").
|
Select("path, count(*) as count").
|
||||||
Group("path").
|
Group("path").
|
||||||
Having("count(*) > 1").
|
Having("count(*) > 1").
|
||||||
|
Unscoped().
|
||||||
Find(&siteDuplicates).Error; err != nil {
|
Find(&siteDuplicates).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -46,6 +47,7 @@ var FixSiteAndStreamPathUnique = &gormigrate.Migration{
|
||||||
Select("path, count(*) as count").
|
Select("path, count(*) as count").
|
||||||
Group("path").
|
Group("path").
|
||||||
Having("count(*) > 1").
|
Having("count(*) > 1").
|
||||||
|
Unscoped().
|
||||||
Find(&streamDuplicates).Error; err != nil {
|
Find(&streamDuplicates).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue