fix(postgres)!: rename the store's tables so they cannot collide

Open
#311 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
postgresql, rust
Domain
backend, database

Research direction

Read migration 0001 and the store’s PostgreSQL statements to find where events and snapshots are created and used. Check the documented schema change from #310 before choosing the new names. Add a migration that renames existing tables and update the store to use the new names; done means existing databases migrate successfully and fresh databases use collision resistant names.

Written by the indexing model from the issue text.

Description

The store's tables are called events and snapshots in the default schema, and 0001 creates them with CREATE TABLE IF NOT EXISTS. If an application sharing the database already has a table events, 0001 skips it, and migrate records version 1 and returns Ok. The only trace is PostgreSQL's notice, which sqlx logs at info level. The store's first statement against that table then fails, which for an event-sourced actor is the read of its recovery. Since #305 the README invites sharing a database, so this becomes more likely.

The tables should be renamed, to tellus_events and tellus_snapshots or into a schema of their own (tellus.events). That is a breaking change, and existing databases need a migration which renames their tables.

This should land after #310, so that the documented schema already has the new names.

Dominant language
Rust
Stars
37
Forks
1
Avg merge
6h 36m
Merged PRs (30d)
123

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tellus-rs/tellus

All issues in tellus-rs/tellus

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.