Skip to content

Commit

Permalink
docs: update readme files
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnigir1 committed Dec 11, 2024
1 parent 6b7e3ab commit 3978835
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
3 changes: 2 additions & 1 deletion apps/processing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Available options:
|-----------------------------|--------------------------------------------------------------------------------------------------------------------------------|-----------|----------------------------------|-----------------------------------------------------------------|
| `CHAINS` | JSON array of chain configurations | N/A | Yes | Each chain object requires: `id` (number), `name` (string), `rpcUrls` (string array). Optional: `fetchLimit` (default: 500), `fetchDelayMs` (default: 1000) |
| `DATABASE_URL` | PostgreSQL Data Layer database connection URL | N/A | Yes | |
| `DATABASE_SCHEMA` | PostgreSQL Data Layer database schema name | public | Yes | |
| `DATABASE_SCHEMA` | PostgreSQL Data Layer database chain-data schema name | public | Yes | |
| `DATABASE_REGISTRIES_SCHEMA` | PostgreSQL Data Layer database registries schema name | public | Yes | |
| `INDEXER_GRAPHQL_URL` | GraphQL endpoint for the indexer | N/A | Yes | |
| `INDEXER_ADMIN_SECRET` | Admin secret for indexer authentication | N/A | Yes | |
| `IPFS_GATEWAYS_URL` | Array of IPFS gateway URLs | N/A | Yes | Multiple gateways for redundancy |
Expand Down
7 changes: 6 additions & 1 deletion packages/data-flow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ The `EventsProcessor` class is responsible for processing events in the processi

The `EventsFetcher` class is responsible for fetching events from the blockchain.

### [StrategyRegistry](./src/strategyRegistry.ts)
### [StrategyRegistry](./src/registries/)

The `StrategyRegistry` stores strategy IDs to populate strategy events with them given the Strategy address.
There are 3 implementations:

- `InMemoryStrategyRegistry`: stores map in-memory
- `DatabaseStrategyRegistry`: persists data to database using IStrategyRepository
- `InMemoryCachedStrategyRegistry`: stores map in-memory as cache and persists to database

### [DataLoader](./src/data-loader/dataLoader.ts)

Expand Down
28 changes: 13 additions & 15 deletions scripts/migrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ This package contains scripts for managing the database schema and migrations.

## Available Scripts

| Script | Description |
| ------------------- | --------------------------------------- |
| `script:db:migrate` | Runs all pending database migrations |
| `script:db:reset` | Drops and recreates the database schema |
| Script | Description |
| -------------------- | ------------------------------------------------------------ |
| `migrate:chain-data` | Runs all pending database migrations on chainData tables |
| `migrate:registries` | Runs all pending database migrations on registries tables |
| `reset:chain-data` | Drops and recreates the database schema on chainData tables |
| `reset:registries` | Drops and recreates the database schema on registries tables |

## Environment Setup

Expand All @@ -16,17 +18,13 @@ This package contains scripts for managing the database schema and migrations.
```env
# Database connection URL
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
# Schema name to manage
DATABASE_SCHEMA=grants_stack
```

### Environment Variables

| Variable | Description | Example |
| ----------------- | ------------------------- | ------------------------------------------------ |
| `DATABASE_URL` | PostgreSQL connection URL | `postgresql://user:password@localhost:5432/mydb` |
| `DATABASE_SCHEMA` | Database schema name | `grants_stack` |
| Variable | Description | Example |
| -------------- | ------------------------- | ------------------------------------------------ |
| `DATABASE_URL` | PostgreSQL connection URL | `postgresql://user:password@localhost:5432/mydb` |

## Usage

Expand All @@ -41,7 +39,7 @@ pnpm install
To apply all pending migrations:

```bash
pnpm script:db:migrate
pnpm migrate:chain-data --schema=schema_name
```

This will:
Expand All @@ -57,7 +55,7 @@ This will:
To completely reset the database schema:

```bash
pnpm script:db:reset
pnpm reset:chain-data --schema=schema_name
```

**Warning**: This will:
Expand All @@ -70,10 +68,10 @@ pnpm script:db:reset

### Adding New Migrations

1. Create a new migration file in [`packages/repository/src/migrations`](../../packages//repository//migrations)
1. Create a new migration file in [`packages/repository/src/migrations`](../../packages//repository/migrations)
2. Name it using the format: `YYYYMMDDTHHmmss_description.ts`
3. Implement the `up` and `down` functions
4. Run `pnpm script:db:migrate` to apply the new migration
4. Run `pnpm migrate:chain-data` to apply the new migration

Example migration file:

Expand Down

0 comments on commit 3978835

Please sign in to comment.