Skip to content

Commit

Permalink
Add single database configuration instructions (#37)
Browse files Browse the repository at this point in the history
* Add single database configuration instructions

* Update README.md

Co-authored-by: Nick Pezza <pezza@hey.com>

* Update README.md

Co-authored-by: Nick Pezza <pezza@hey.com>

---------

Co-authored-by: Nick Pezza <pezza@hey.com>
  • Loading branch information
jimmypoulsen and npezza93 authored Sep 24, 2024
1 parent ba1b1e5 commit 354e67a
Showing 1 changed file with 11 additions and 1 deletion.
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.

## Configuration

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

0 comments on commit 354e67a

Please sign in to comment.