MCPcopy Create free account
hub / github.com/bytebase/bytebase / writeIndexesSDL

Function writeIndexesSDL

backend/plugin/schema/pg/get_database_definition.go:3318–3339  ·  view source on GitHub ↗
(out io.Writer, schemaName string, table *storepb.TableMetadata)

Source from the content-addressed store, hash-verified

3316}
3317
3318func writeIndexesSDL(out io.Writer, schemaName string, table *storepb.TableMetadata) error {
3319 if tableMissingColumnMetadata(table) {
3320 // Indexes would reference columns absent from the dump.
3321 return nil
3322 }
3323 for _, index := range table.Indexes {
3324 // Skip indexes that are constraints (primary key, unique constraints)
3325 // These are already handled in the CREATE TABLE statement
3326 if index.Primary || index.IsConstraint {
3327 continue
3328 }
3329
3330 if err := writeIndexSDL(out, schemaName, table.Name, index, len(table.Partitions) > 0); err != nil {
3331 return err
3332 }
3333
3334 if _, err := io.WriteString(out, ";\n\n"); err != nil {
3335 return err
3336 }
3337 }
3338 return nil
3339}
3340
3341func writeIndexSDL(out io.Writer, schemaName string, tableName string, index *storepb.IndexMetadata, useOnlyClause bool) error {
3342 return writeIndexInternal(out, schemaName, tableName, index, useOnlyClause, false)

Callers 2

getSDLFormatFunction · 0.85

Calls 2

writeIndexSDLFunction · 0.85

Tested by

no test coverage detected