Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Use PostgreSQL as default Dragonfly data store #14

Open
5 tasks
hmans opened this issue Aug 10, 2014 · 5 comments
Open
5 tasks

Use PostgreSQL as default Dragonfly data store #14

hmans opened this issue Aug 10, 2014 · 5 comments
Assignees

Comments

@hmans
Copy link
Owner

hmans commented Aug 10, 2014

Let's get rid of the immediate S3 dependency and make Dragonfly store its uploaded assets in the database instead.

Otherwise:

  • Check how well ActiveRecord copes with bytea columns.
  • If there are no immediate problems, create an AR model class to store a single asset (using bytea.)
  • Write a custom Dragonfly data store that uses this model to store the binary data, using the model ID as the Dragonfly UID.

Bonus points:

  • Migrate existing data on pants.social to this new data store?
@hmans hmans self-assigned this Aug 10, 2014
@KlausTrainer
Copy link

Just out of curiosity: Why not use PostgresDataStore?

@hmans
Copy link
Owner Author

hmans commented Sep 12, 2014

It generally works fine, but has one drawback: when dealing with LOs, PostgreSQL has a native ID type (was it oid?) to reference these, and ActiveRecord doesn't understand it (without major hackery). This may not sound like a big problem, since I could just use integer columns instead (OIDs are integer values), however: when you dump your database and then re-import that dump (think: loading a backup after a database failure), these OIDs will change. Oops! The native oid column takes this into account and would automatically change to the new values, but of course stand-alone Integer columns would not. To cut a long story short: I would make dump-based backups unusable, and this, of course, if a big problem.

@KlausTrainer
Copy link

Thanks for the background information :)

@matfiz
Copy link

matfiz commented Feb 16, 2016

@KlausTrainer @hmans Rails supports now OID data type, just do in migration:
t.column :column_name, :oid, null: false
I have not faced any problems during db backup/recovery.

@KlausTrainer
Copy link

@matfiz Great :) Thanks for giving notice!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants