17👍
Not sure if best-est approach, but we store:
- unique object ID (might be UUID) in database (for which Postgres has a native
UUID
type) - bucket name and path in configuration (as we store all the objects of the same type under the same bucket+path)
That way you can at least:
- Move objects to a different bucket / path without havig to rewrite your whole database table
- Switch from S3 to local storage if you choose so
- Throw away your primary key (e.g. while partitioning tables) without loosing track of your objects
Source:stackexchange.com