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

Function writeCreateIndexDiff

backend/plugin/schema/pg/metadata_migration.go:1381–1393  ·  view source on GitHub ↗
(out *strings.Builder, schemaName, tableName string, index *storepb.IndexMetadata)

Source from the content-addressed store, hash-verified

1379}
1380
1381func writeCreateIndexDiff(out *strings.Builder, schemaName, tableName string, index *storepb.IndexMetadata) error {
1382 if index == nil {
1383 return nil
1384 }
1385 switch {
1386 case index.GetPrimary():
1387 return writePrimaryKey(out, schemaName, tableName, index)
1388 case index.GetUnique() && index.GetIsConstraint():
1389 return writeUniqueKey(out, schemaName, tableName, index)
1390 default:
1391 return writeCreateRegularIndex(out, schemaName, tableName, index, false)
1392 }
1393}
1394
1395func writeCreateRegularIndex(out *strings.Builder, schemaName, tableName string, index *storepb.IndexMetadata, useOnlyClause bool) error {
1396 if index.GetDefinition() != "" {

Callers 1

writeAlterTableDiffFunction · 0.85

Calls 6

writePrimaryKeyFunction · 0.85
writeUniqueKeyFunction · 0.85
writeCreateRegularIndexFunction · 0.85
GetPrimaryMethod · 0.45
GetUniqueMethod · 0.45
GetIsConstraintMethod · 0.45

Tested by

no test coverage detected