(ctx context.Context, table *schema.Table)
| 9 | ) |
| 10 | |
| 11 | func (c *Client) createTable(ctx context.Context, table *schema.Table) (err error) { |
| 12 | c.logger.Debug().Str("table", table.Name).Msg("Table doesn't exist, creating") |
| 13 | defer func() { |
| 14 | if err != nil { |
| 15 | c.logErr(err) |
| 16 | } |
| 17 | }() |
| 18 | |
| 19 | _, err = c.db.ExecContext(ctx, queries.CreateTable(c.spec.Schema, table)) |
| 20 | if err != nil { |
| 21 | return fmt.Errorf("failed to create table %s: %w", table.Name, err) |
| 22 | } |
| 23 | |
| 24 | return c.ensureTVP(ctx, table) |
| 25 | } |
| 26 | |
| 27 | func (c *Client) dropTable(ctx context.Context, table *schema.Table) (err error) { |
| 28 | c.logger.Debug().Str("table", table.Name).Msg("Table exists, dropping") |
no test coverage detected