MCPcopy Index your code
hub / github.com/dnote/dnote / TestMigrate_duplicateVersion

Function TestMigrate_duplicateVersion

pkg/server/database/migrate_test.go:162–183  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

160}
161
162func TestMigrate_duplicateVersion(t *testing.T) {
163 db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
164 if err != nil {
165 t.Fatalf("failed to open database: %v", err)
166 }
167
168 // Create migrations with duplicate version numbers
169 migrationsFs := fstest.MapFS{
170 "001-first.sql": &fstest.MapFile{
171 Data: []byte("SELECT 1;"),
172 },
173 "001-second.sql": &fstest.MapFile{
174 Data: []byte("SELECT 2;"),
175 },
176 }
177
178 // Should return error for duplicate version
179 err = migrate(db, migrationsFs)
180 if err == nil {
181 t.Fatal("expected error for duplicate version numbers, got nil")
182 }
183}
184
185func TestMigrate_initTableError(t *testing.T) {
186 db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})

Callers

nothing calls this directly

Calls 2

migrateFunction · 0.85
OpenMethod · 0.80

Tested by

no test coverage detected