Skip to content

Commit 77883c1

Browse files
committed
Added exadata nodes migration
1 parent 0a4e77a commit 77883c1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright (c) 2024 Sorint.lab S.p.A.
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU General Public License as published by
5+
// the Free Software Foundation, either version 3 of the License, or
6+
// (at your option) any later version.
7+
//
8+
// This program is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
// GNU General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU General Public License
14+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
package migrations
16+
17+
import (
18+
"fmt"
19+
20+
"github.com/ercole-io/ercole/v2/model"
21+
migrate "github.com/xakep666/mongo-migrate"
22+
"go.mongodb.org/mongo-driver/mongo"
23+
)
24+
25+
func init() {
26+
nodes := []model.Node{
27+
{
28+
Name: "Exadata List",
29+
Roles: []string{
30+
"admin",
31+
},
32+
Parent: "Exadata",
33+
},
34+
{
35+
Name: "Patch Advisor",
36+
Roles: []string{
37+
"admin",
38+
},
39+
Parent: "Exadata",
40+
},
41+
}
42+
43+
err := migrate.Register(func(db *mongo.Database) error {
44+
for _, newNode := range nodes {
45+
if err := insertNode(newNode, db); err != nil {
46+
return err
47+
}
48+
}
49+
50+
return nil
51+
}, func(db *mongo.Database) error {
52+
return nil
53+
})
54+
55+
if err != nil {
56+
fmt.Printf("%v\n", err)
57+
return
58+
}
59+
}

0 commit comments

Comments
 (0)