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

Function writeAddCheckConstraint

backend/plugin/schema/pg/metadata_migration.go:1361–1369  ·  view source on GitHub ↗
(out *strings.Builder, schemaName, tableName string, check *storepb.CheckConstraintMetadata)

Source from the content-addressed store, hash-verified

1359}
1360
1361func writeAddCheckConstraint(out *strings.Builder, schemaName, tableName string, check *storepb.CheckConstraintMetadata) error {
1362 if check == nil {
1363 return nil
1364 }
1365 if _, err := fmt.Fprintf(out, "ALTER TABLE \"%s\".\"%s\" ADD CONSTRAINT \"%s\" CHECK %s;\n\n", schemaName, tableName, check.GetName(), check.GetExpression()); err != nil {
1366 return err
1367 }
1368 return nil
1369}
1370
1371func writeAddExcludeConstraint(out *strings.Builder, schemaName, tableName string, exclude *storepb.ExcludeConstraintMetadata) error {
1372 if exclude == nil {

Callers 1

writeAlterTableDiffFunction · 0.70

Calls 2

GetNameMethod · 0.45
GetExpressionMethod · 0.45

Tested by

no test coverage detected