Skip to content

Commit 354e67a

Browse files
Add single database configuration instructions (#37)
* 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>
1 parent ba1b1e5 commit 354e67a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Solid Cable is a database-backed Action Cable adapter that keeps messages in a t
44

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

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

55+
### Single database configuration
56+
57+
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.
58+
59+
1. Copy the contents of `db/cable_schema.rb` into a normal migration and delete `db/cable_schema.rb`
60+
2. Remove `connects_to` from `config/cable.yml`
61+
3. `bin/rails db:migrate`
62+
63+
You won't have multiple databases, so `database.yml` doesn't need to have primary and cable database.
64+
5565
## Configuration
5666

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

0 commit comments

Comments
 (0)