-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use unique combination of hostname/bucket/key for external storages #29484
Conversation
a992104
to
13c7b05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this will need some kind of migration script.
Changing the storage id of an existing external storage will cause all fileids for the storage to change with all the effects that has
Right, so my attempt for that would be to just iterate over all configured external mounts and if we match the old pattern for an entry in oc_storages update that with the new format. Doing it during storage setup sounds a bit too risky to me and we can actually do this during upgrade since s3 only has key/secret auth and does not require any user session. |
Signed-off-by: Julius Härtl <jus@bitgrid.net>
13c7b05
to
52ce7f4
Compare
Added a migration step to rename the storage ids for all external storages using the "amazons3" backend, please have another look |
@icewind1991 can you re-review with latest changes from @juliushaertl so we can provide it to the customer :) Thanks ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After enabling the app and applying this patch I get
An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_external_mounts' doesn't exist
apps/files_external/lib/Migration/Version1015Date20211104103506.php
Outdated
Show resolved
Hide resolved
Found a fix, if apps/files_external/lib/Migration/Version1011Date20200630192246.php::changeSchema return null. The schema will be written immediately to the database, if it returns $schema, it will only write it in the next MigrationStep that returns null (or the last one). |
f2fa7ad
to
ad08803
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested under this two scenarios and the migration worked now:
- Setup Nextcloud with master branch => setup external storage with s3 => switch to this branch => migrations work
- Setup Nextcloud with this branch, activating the files_external app works now and I can add an external storage
Signed-off-by: Julius Härtl <jus@bitgrid.net>
ad08803
to
b7d0075
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 please see comment about some thing to test
Also gave that another test run 👍 Thanks for helping out here @CarlSchwan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some basic testing for the migration
/backport to stable22 |
/backport to stable21 |
/backport to stable20 |
Avoid conflicts with the storage id of external s3 storages when the bucket name is the same for different mountpoints.