GithubHelp home page GithubHelp logo

francois / active_storage_db Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blocknotes/active_storage_db

0.0 0.0 0.0 212 KB

An ActiveStorage service plugin to store files in a PostgreSQL / MySQL / MSSQL database (for Rails 6/7)

License: MIT License

Shell 0.03% JavaScript 0.87% Ruby 85.49% CSS 1.38% HTML 12.24%

active_storage_db's Introduction

Active Storage DB

gem version gem downloads maintainability

linters specs Postgres specs MySQL

An Active Storage service upload/download plugin that stores files in a PostgreSQL or MySQL database. Experimental support also for MSSQL.

Main features:

  • attachment data stored in a binary field (or blob);
  • all service methods implemented;
  • supports Rails 6 and 7.

Useful also with platforms like Heroku (due to their ephemeral file system).

Installation

  • Setup Active Storage in your Rails application
  • Add to your Gemfile gem 'active_storage_db' (and execute: bundle)
  • Install the gem migrations: bin/rails active_storage_db:install:migrations (and execute: bin/rails db:migrate)
  • Add to your config/routes.rb: mount ActiveStorageDB::Engine => '/active_storage_db'
  • Change Active Storage service in config/environments/development.rb to: config.active_storage.service = :db
  • Add to config/storage.yml:
db:
  service: DB

Misc

Some utility tasks are available:

# list attachments ordered by blob id desc (with limit 100):
bin/rails 'asdb:list'
# search attachments by filename (or part of it)
bin/rails 'asdb:search[some_filename]'
# download attachment by blob id (retrieved with list or search tasks) - the second argument is the destination:
bin/rails 'asdb:download[123,/tmp]'

Do you like it? Star it!

If you use this component just star it. A developer is more motivated to improve a project when there is some interest.

Or consider offering me a coffee, it's a small thing but it is greatly appreciated: about me.

Contributors

License

The gem is available as open source under the terms of the MIT License.

active_storage_db's People

Contributors

blocknotes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.