(t *testing.T)
| 176 | } |
| 177 | |
| 178 | func TestSchemaMetadata_DropTable(t *testing.T) { |
| 179 | metadata := &storepb.DatabaseSchemaMetadata{ |
| 180 | Name: "testdb", |
| 181 | Schemas: []*storepb.SchemaMetadata{ |
| 182 | { |
| 183 | Name: "public", |
| 184 | Tables: []*storepb.TableMetadata{ |
| 185 | {Name: "users"}, |
| 186 | {Name: "products"}, |
| 187 | }, |
| 188 | }, |
| 189 | }, |
| 190 | } |
| 191 | |
| 192 | schema := NewDatabaseMetadata(metadata, nil, nil, storepb.Engine_POSTGRES, true) |
| 193 | schemaMeta := schema.GetSchemaMetadata("public") |
| 194 | |
| 195 | // Drop table |
| 196 | err := schemaMeta.DropTable("users") |
| 197 | |
| 198 | require.Nil(t, err) |
| 199 | |
| 200 | // Verify table is gone |
| 201 | retrieved := schemaMeta.GetTable("users") |
| 202 | require.Nil(t, retrieved) |
| 203 | |
| 204 | // Verify other table still exists |
| 205 | retrieved = schemaMeta.GetTable("products") |
| 206 | require.NotNil(t, retrieved) |
| 207 | } |
| 208 | |
| 209 | func TestSchemaMetadata_DropTable_NotExists(t *testing.T) { |
| 210 | metadata := &storepb.DatabaseSchemaMetadata{ |
nothing calls this directly
no test coverage detected