{"id":18140845,"url":"https://github.com/gui/carrierwave-postgresql-table","last_synced_at":"2025-04-19T20:43:23.619Z","repository":{"id":62555158,"uuid":"69177162","full_name":"GUI/carrierwave-postgresql-table","owner":"GUI","description":"Store CarrierWave files in PostgreSQL (supporting multiple versions per uploader).","archived":false,"fork":false,"pushed_at":"2018-11-22T20:22:47.000Z","size":50,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-12T20:42:50.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GUI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-25T16:44:16.000Z","updated_at":"2018-11-22T20:19:40.000Z","dependencies_parsed_at":"2022-11-03T05:15:50.735Z","dependency_job_id":null,"html_url":"https://github.com/GUI/carrierwave-postgresql-table","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GUI%2Fcarrierwave-postgresql-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GUI%2Fcarrierwave-postgresql-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GUI%2Fcarrierwave-postgresql-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GUI%2Fcarrierwave-postgresql-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GUI","download_url":"https://codeload.github.com/GUI/carrierwave-postgresql-table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222601455,"owners_count":17009691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-01T16:07:06.369Z","updated_at":"2024-11-01T16:07:25.604Z","avatar_url":"https://github.com/GUI.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# carrierwave-postgresql-table\n\n[![Circle CI](https://circleci.com/gh/GUI/carrierwave-postgresql-table.svg?style=svg)](https://circleci.com/gh/GUI/carrierwave-postgresql-table)\n\nA PostgreSQL storage adapter for [CarrierWave](https://github.com/carrierwaveuploader/carrierwave). Files are stored as PostgreSQL [large objects](https://www.postgresql.org/docs/current/static/largeobjects.html).\n\nThis gem is similar to [carrierwave-postgresql](https://github.com/diogob/carrierwave-postgresql), but differs in how it stores file metadata. This gem uses an extra table to store additional file metadata, allowing it to support multiple CarrierWave [versions](https://github.com/carrierwaveuploader/carrierwave#adding-versions) on a single uploader.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"carrierwave-postgresql-table\"\n```\n\n## Compatibility\n\ncarrierwave-postgresql-table is tested against the following versions of CarrierWave, Rails, and Ruby:\n\n- CarrierWave 0.11, 1.0, 1.1, 1.2\n- Rails 4.2, 5.0, 5.1, 5.2\n- Ruby 2.2, 2.3, 2.4, 2.5\n\n## Usage\n\nGenerate the table to store the file uploads:\n\n```sh\n$ rails generate carrierwave_postgresql_table:migration\n$ rake db:migrate\n```\n\nAdjust your uploader to use the `postgresql_table` storage adapter:\n\n```ruby\nclass AvatarUploader \u003c CarrierWave::Uploader::Base\n  storage :postgresql_table\n\n  def store_dir\n    \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n  end\nend\n```\n\nAn optional Rack application is available to provide an endpoint that will stream your files from PostgreSQL. To enable this endpoint, you can mount it in your `config/routes.rb` file:\n\n```ruby\nRails.application.routes.draw do\n  mount CarrierWave::PostgresqlTable::RackApp.new =\u003e \"/uploads\"\nend\n```\n\nThe Rack application can also be combined with other routing functionality. For example, to limit uploads to authenticated users when used with Devise:\n\n```ruby\nRails.application.routes.draw do\n  authenticate :user do\n    mount CarrierWave::PostgresqlTable::RackApp.new =\u003e \"/uploads\"\n  end\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [https://github.com/GUI/carrierwave-postgresql-table](https://github.com/GUI/carrierwave-postgresql-table).\n\n## Acknowledgments\n\nHat tip to the people behind [carrierwave-postgresql](https://github.com/diogob/carrierwave-postgresql) and [refile-postgres](https://github.com/krists/refile-postgres), which this code is based on.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgui%2Fcarrierwave-postgresql-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgui%2Fcarrierwave-postgresql-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgui%2Fcarrierwave-postgresql-table/lists"}