feat: add core data model
This commit is contained in:
23
backend/internal/domain/models_test.go
Normal file
23
backend/internal/domain/models_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/glebarez/sqlite"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func TestAutoMigrateCreatesCoreTables(t *testing.T) {
|
||||
database, err := gorm.Open(sqlite.Open("file::memory:?cache=shared"), &gorm.Config{})
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NoError(t, AutoMigrate(database))
|
||||
|
||||
for _, table := range []string{
|
||||
"users", "projects", "inbox_items", "tasks", "notes", "sources",
|
||||
"ai_sessions", "tags", "project_events", "ai_keys", "ai_call_logs", "task_shares",
|
||||
} {
|
||||
require.True(t, database.Migrator().HasTable(table), "missing table %s", table)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user