# config-center

A config storage system for TiDB Cloud clusters.

## Database Schema

The current database schema is documented in `schema.sql`. This file is auto-generated from the migration files.

To regenerate after adding new migrations:
```bash
make dump-schema
```

## Development

Basically, follow the [Google AIP](https://google.aip.dev/) with following expected:
- **Not** use token based pager since most ui pager are page number based
- **Not** use resource id like `publishers/{publisher}/books/{book}` to behavier like other dbaas service
- Use simple filter instead of [AIP-160](https://google.aip.dev/160)

## Dict management

1. Adjust dict_dumper: all param key and type **must** use upstream code as source
2. Execute `ctl dict import2` in config-center pod to import data to the database
3. Execute `ctl dict import1` in config-center pod to fill other fields like description and hot_reload (wo try to not use it)

## Default Template Management

### Dedicated
Just modify the gitops(tidbcloud/tidb-configuration) and click the "Sync" in the ops portal

### Nextgen
Update ctl/migrate_ng.go and execute `ctl migrate ng-base`

## Regional Mode
Cluster datas are storaged in the region. Global and tenant data are storaged in the global and then sync to the each region. Only SHARED_POOL(Nextgen Resource Pool) and LOGICAL_CLUSTER(Nextgen Instance) are using regional mode currently.