pgroll/pkg/state
Andrew Farries 0020c3e751
Store indexes in internal schema representation (#57)
Add information about indexes on a table to `pg-roll`'s internal state
storage.

For each table, store an additional JSON object mapping each index name
on the table to details of the index (initially just its name).

An example of the resulting JSON is:

```json
{
  "tables": {
    "fruits": {
      "oid": "16497",
      "name": "fruits",
      "columns": {
        "id": {
          "name": "id",
          "type": "integer",
          "comment": null,
          "default": "nextval('_pgroll_new_fruits_id_seq'::regclass)",
          "nullable": false
        },
        "name": {
          "name": "name",
          "type": "varchar(255)",
          "comment": null,
          "default": null,
          "nullable": false
        }
      },
      "comment": null,
      "indexes": {
        "_pgroll_idx_fruits_name": {
          "name": "_pgroll_idx_fruits_name"
        },
        "_pgroll_new_fruits_pkey": {
          "name": "_pgroll_new_fruits_pkey"
        },
        "_pgroll_new_fruits_name_key": {
          "name": "_pgroll_new_fruits_name_key"
        }
      }
    }
  }
}
```

Also add fields to the `Schema` model structs to allow the new `indexes`
field to be unmarshalled.
2023-08-17 14:26:44 +01:00
..
errors.go Add a sentinel error for no active migration (#11) 2023-07-03 14:18:31 +01:00
state.go Store indexes in internal schema representation (#57) 2023-08-17 14:26:44 +01:00