Skip to content
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

Add oauth2_clients migration for Owncloud #30276

Merged
merged 1 commit into from
Mar 28, 2022
Merged

Conversation

artonge
Copy link
Contributor

@artonge artonge commented Dec 15, 2021

Handy script to test the migration. Use it from a nextcloud root directory containing the migration.

#!/bin/bash

set -eu

# Serving ownCloud then Nextcloud at localhost:8080
# Username: admin
# Password: admin

docker kill oc || true
docker rm oc || true

docker run \
	--rm \
	--name oc \
	--detach \
	--env OWNCLOUD_DOMAIN=localhost:8080 \
	--publish 8080:8080 \
	--volume /var/www/owncloud \
	--volume "$PWD":/mnt/local \
	owncloud/server:10.5

docker exec -it oc apt update
docker exec -it oc apt install -y nano rsync

docker exec -it oc sed -i '9,14d' /var/www/owncloud/config/config.php
docker exec -it oc occ app:enable oauth2
docker exec -it oc occ market:install calendar
docker exec -it oc occ app:enable configreport
docker exec -it oc cp /var/www/owncloud/config/config.php /var/www/config.php

instance=""
read -rp "> Double press enter to start the migration." instance

docker exec -it oc rsync --delete --recursive --human-readable --exclude .git --exclude node_modules /mnt/local/ /var/www/owncloud
docker exec -it oc cp /var/www/config.php /var/www/owncloud/config/config.php
docker exec -it oc chown -R www-data:www-data /var/www/owncloud

docker exec -it oc occ upgrade -vvv || true

occ db:convert-filecache-bigint
occ db:add-missing-columns
occ db:add-missing-indices
occ db:add-missing-primary-keys

# Use this command to copy your change in MigrateOauthTables.php to the docker container.
# docker exec -it oc cp /mnt/local/lib/private/Repair/Owncloud/MigrateOauthTables.php /var/www/owncloud/lib/private/Repair/Owncloud/MigrateOauthTables.php

@artonge artonge added the 2. developing Work in progress label Dec 15, 2021
@artonge artonge self-assigned this Dec 15, 2021
@artonge artonge marked this pull request as draft December 15, 2021 09:52
@artonge artonge marked this pull request as ready for review December 15, 2021 09:52
@artonge artonge force-pushed the feature/add_oauth2_migration branch 3 times, most recently from 5bea261 to ae95a7c Compare December 16, 2021 15:43
@artonge artonge closed this Dec 16, 2021
@artonge artonge reopened this Dec 16, 2021
@artonge artonge requested review from a team, ArtificialOwl, CarlSchwan and come-nc and removed request for a team December 16, 2021 15:58
}

public function run(IOutput $output) {
$schema = new SchemaWrapper($this->db);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I just haven't seen any such code before, but building those migrations by hand and outside of regular migrations feels like something is off.

Why is this not done in a regular migration?

Copy link
Contributor Author

@artonge artonge Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a regular migration but a repair step. I took inspiration from existing ones: https:/nextcloud/server/tree/master/lib/private/Repair/Owncloud. Should we use another approach?

@artonge
Copy link
Contributor Author

artonge commented Dec 20, 2021

/backport to stable23

@artonge
Copy link
Contributor Author

artonge commented Dec 20, 2021

/backport to stable22

@artonge
Copy link
Contributor Author

artonge commented Dec 20, 2021

Limiting backport to stable22 for now. Should we backport this to older versions too? Not sure if the migration path is OC v10 -> NC20 -> ... or OC v10 -> NC latest

@artonge
Copy link
Contributor Author

artonge commented Jan 4, 2022

/rebase

@artonge artonge force-pushed the feature/add_oauth2_migration branch 3 times, most recently from c6e8614 to 24c4db9 Compare January 19, 2022 17:48
@artonge artonge added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Feb 16, 2022
@artonge
Copy link
Contributor Author

artonge commented Mar 24, 2022

/rebase

@artonge artonge requested a review from a team March 24, 2022 13:09
@artonge artonge force-pushed the feature/add_oauth2_migration branch 2 times, most recently from 0c2e4fe to 2f5ad65 Compare March 24, 2022 17:06
@artonge artonge force-pushed the feature/add_oauth2_migration branch from 2f5ad65 to c572286 Compare March 24, 2022 17:08
Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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

Successfully merging this pull request may close these issues.

5 participants