Skip to content

Commit 71448c5

Browse files
committed
doc: update README
1 parent 777d411 commit 71448c5

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![specs Postgres](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_71.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_postgres_71.yml)
99
[![specs MySQL](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_71.yml/badge.svg)](https://github.com/blocknotes/active_storage_db/actions/workflows/specs_mysql_71.yml)
1010

11-
An Active Storage service upload/download plugin that stores files in a PostgreSQL or MySQL database. Experimental support also for MSSQL.
11+
An Active Storage service upload/download plugin that stores files in a PostgreSQL or MySQL database. Experimental support also for MSSQL and SQLite.
1212

1313
Main features:
1414
- attachment data stored in a binary field (or blob);
@@ -31,29 +31,29 @@ db:
3131
service: DB
3232
```
3333
34-
If there is a need to support a separate database connection for storing the `ActiveStorageDB` files:
34+
### Customizations
3535
36-
1. Add a separate database configuration for the environment (this one is just an example)
36+
To setup a separate database connection for the `ActiveStorageDB` migrations and files data:
37+
38+
1. Add a different database configuration per environment to `config/database.yml`, e.g:
3739

3840
```yml
3941
attachments:
4042
database: attachments
41-
pool: 5
42-
username: root
4343
migrations_paths: config/attachments_migrate
44+
# other connection details ...
4445
```
4546

46-
2. Create a separate initializer file in `config/initializera/active_storage_db.rb` to set the database:
47+
2. Extend the ActiveStorage base record class providing the `connects_to` options, e.g `app/overrides/models/active_storage_db/application_record_override.rb` (or add an initializer for _ActiveStorageDB_):
4748

4849
```rb
49-
# app/overrides/models/active_storage_db/application_record_override.rb
5050
ActiveStorageDB::ApplicationRecord.class_eval do
5151
connects_to database: { reading: :attachments, writing: :attachments }
5252
end
5353
```
5454

55-
3. Move the `ActiveStorageDB` related migrations to a configured storage migrations path
56-
4. Create the database and execute the migrations
55+
3. Move the _ActiveStorageDB_ migrations to the specified migrations path
56+
4. Execute the _rails db:migrate_ task
5757

5858
## Misc
5959

@@ -74,9 +74,9 @@ If you use this component just star it. A developer is more motivated to improve
7474

7575
Or consider offering me a coffee, it's a small thing but it is greatly appreciated: [about me](https://www.blocknot.es/about-me).
7676

77-
## Contributors
77+
## Development
7878

79-
- [Mattia Roccoberton](https://blocknot.es/): author
79+
- Author: [Mattia Roccoberton](https://blocknot.es/)
8080
- Inspired by [activestorage-database-service](https://github.com/TitovDigital/activestorage-database-service) project
8181

8282
## License

0 commit comments

Comments
 (0)