Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add single database configuration instructions #37

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Solid Cable is a database-backed Action Cable adapter that keeps messages in a t

> [!NOTE]
> Solid Cable is tested to work with MySQL, SQLite, and PostgreSQL.
>
>
> Action Cable already has a [dedicated PostgreSQL adapter](https://guides.rubyonrails.org/action_cable_overview.html#postgresql-adapter),
> which utilizes the builtin `NOTIFY` command for better performance. However, that
> adapter has an 8kb limit on its payload. Solid Cable is a great alternative if you find yourself
Expand Down Expand Up @@ -52,6 +52,16 @@ production:

Then run `db:prepare` in production to ensure the database is created and the schema is loaded.

### Single database configuration

Running Solid Cable in a separate database is recommended, but it's also possible to use a single database for both the app and Action Cable.

1. Copy the contents of `db/cable_schema.rb` into a normal migration and delete `db/cable_schema.rb`
2. Remove `connects_to` from `config/cable.yml`
3. `bin/rails db:migrate`

You won't have multiple databases, so `database.yml` doesn't need to have primary and cable database.
jimmypoulsen marked this conversation as resolved.
Show resolved Hide resolved

## Configuration

All configuration is managed via the `config/cable.yml` file. By default, it'll be configured like this:
Expand Down