MCPcopy Index your code
hub / github.com/bytebase/bytebase / TestSchemaMetadata_CreateTable

Function TestSchemaMetadata_CreateTable

backend/store/model/database_test.go:131–153  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

129}
130
131func TestSchemaMetadata_CreateTable(t *testing.T) {
132 metadata := &storepb.DatabaseSchemaMetadata{
133 Name: "testdb",
134 Schemas: []*storepb.SchemaMetadata{
135 {Name: "public"},
136 },
137 }
138
139 schema := NewDatabaseMetadata(metadata, nil, nil, storepb.Engine_POSTGRES, true)
140 schemaMeta := schema.GetSchemaMetadata("public")
141
142 // Create a new table
143 tableMeta, err := schemaMeta.CreateTable("products")
144
145 require.Nil(t, err)
146 require.NotNil(t, tableMeta)
147 require.Equal(t, "products", tableMeta.GetProto().Name)
148
149 // Verify table is now accessible via GetTable
150 retrieved := schemaMeta.GetTable("products")
151 require.NotNil(t, retrieved)
152 require.Equal(t, "products", retrieved.GetProto().Name)
153}
154
155func TestSchemaMetadata_CreateTable_AlreadyExists(t *testing.T) {
156 metadata := &storepb.DatabaseSchemaMetadata{

Callers

nothing calls this directly

Calls 6

GetSchemaMetadataMethod · 0.95
NewDatabaseMetadataFunction · 0.85
CreateTableMethod · 0.80
EqualMethod · 0.65
GetProtoMethod · 0.45
GetTableMethod · 0.45

Tested by

no test coverage detected