You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
12
12
13
13
Main features:
14
14
- attachment data stored in a binary field (or blob);
@@ -31,29 +31,29 @@ db:
31
31
service: DB
32
32
```
33
33
34
-
If there is a need to support a separate database connection for storing the `ActiveStorageDB` files:
34
+
### Customizations
35
35
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:
37
39
38
40
```yml
39
41
attachments:
40
42
database: attachments
41
-
pool: 5
42
-
username: root
43
43
migrations_paths: config/attachments_migrate
44
+
# other connection details ...
44
45
```
45
46
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_):
0 commit comments