(ctx context.Context, tableName string)
| 479 | } |
| 480 | |
| 481 | func (c *Client) getPKName(ctx context.Context, tableName string) (string, error) { |
| 482 | var pkConstraintName string |
| 483 | err := c.conn.QueryRow(ctx, `SELECT tco.constraint_name FROM information_schema.table_constraints tco JOIN information_schema.key_column_usage kcu |
| 484 | ON kcu.constraint_name = tco.constraint_name |
| 485 | WHERE tco.constraint_type = 'PRIMARY KEY' |
| 486 | AND kcu.table_name = $1`, tableName).Scan(&pkConstraintName) |
| 487 | if err != nil && !errors.Is(err, pgx.ErrNoRows) { |
| 488 | return "", err |
| 489 | } |
| 490 | |
| 491 | return pkConstraintName, nil |
| 492 | } |
| 493 | |
| 494 | func (c *Client) createPerformanceIndexes(ctx context.Context, table *schema.Table) error { |
| 495 | columns := []string{"_cq_source_name", "_cq_sync_time"} |
no test coverage detected