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

WIP: Reimplement dump and implment restore command #2917

Closed
wants to merge 5 commits into from

Conversation

lunny
Copy link
Member

@lunny lunny commented Nov 15, 2017

This PR would like to replace #1637. It reimplemented dump command and old dump file will not be used anymore. And also added a restore command that could restore dumped zip file to some machine. You have to use the same version Gitea with dump when restore.

The dump databases will be stored as <table_name>.yml in one directory. This format is expected to be compatible with Gitea's test fixtures. So that it's easy to export test data from a real system.

Currently it's blocked because yaml package didn't support Gonic name mapping, so I have forked yml package to https://github.com/go-gitea/yaml. Before that package supports that feature, this PR is not really work.

@lunny lunny added type/feature Completely new functionality. Can only be merged if feature freeze is not active. status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR labels Nov 15, 2017
@lunny lunny added this to the 1.x.x milestone Nov 15, 2017
@codecov-io
Copy link

codecov-io commented Nov 15, 2017

Codecov Report

Merging #2917 into master will decrease coverage by 19.29%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2917      +/-   ##
==========================================
- Coverage    39.4%   20.11%   -19.3%     
==========================================
  Files         393      145     -248     
  Lines       53264    29252   -24012     
==========================================
- Hits        20990     5884   -15106     
+ Misses      29287    22474    -6813     
+ Partials     2987      894    -2093
Impacted Files Coverage Δ
models/models.go 21.15% <0%> (-35.26%) ⬇️
routers/api/v1/misc/version.go 0% <0%> (-100%) ⬇️
routers/api/v1/misc/swagger.go 0% <0%> (-100%) ⬇️
modules/util/time_stamp.go 0% <0%> (-90.91%) ⬇️
modules/sync/exclusive_pool.go 0% <0%> (-89.29%) ⬇️
models/graph.go 0% <0%> (-81.04%) ⬇️
modules/sync/unique_queue.go 0% <0%> (-78.58%) ⬇️
models/status.go 1.73% <0%> (-68.96%) ⬇️
models/repo_activity.go 0% <0%> (-66.28%) ⬇️
routers/repo/activity.go 0% <0%> (-64.71%) ⬇️
... and 369 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d771769...c85526d. Read the comment docs.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 15, 2017
Copy link
Member

@bkcsoft bkcsoft left a comment

Choose a reason for hiding this comment

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

I would keep the gitea dump command for a while and create a gitea backup command instead.

cmd/dump.go Outdated
@@ -1,5 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2016 The Gitea Authors. All rights reserved.
// Copyright 2017 The Gitea Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

Don't change the copyright year ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

But in fact all contents changed.

Copy link
Member

Choose a reason for hiding this comment

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

No it has not 🤔

@lafriks lafriks mentioned this pull request Dec 6, 2017
5 tasks
@elvarb
Copy link

elvarb commented Feb 28, 2018

Any ETA on this?

models/models.go Outdated

var bufferSize = 100
v := reflect.MakeSlice(table.Type, 0, bufferSize)
// BLOCK: need yaml support gonic name mapper
Copy link
Member

Choose a reason for hiding this comment

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

There have been 61 commits to go-yaml/yaml since it was forked into the go-gitea org. Is this still blocked?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will check that.

@bkcsoft bkcsoft added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 29, 2018
@lunny lunny force-pushed the lunny/dump_restore branch 2 times, most recently from 6b392aa to 9a9a0bc Compare May 8, 2018 08:59
@@ -0,0 +1,153 @@
// Copyright 2017 The Gitea Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

As this file is entirely new, I know you wrote it in 2017, however it is likely to get merged in 2018 should this date be updated to 2018?

Copy link
Member Author

Choose a reason for hiding this comment

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

The copyright year should be the time first created I think.

@techknowlogick
Copy link
Member

@lunny It looks like you've made some recent commits to this. Can the blocked label be removed?

@lunny
Copy link
Member Author

lunny commented May 9, 2018

@techknowlogick It still cannot work fine when restore.

@sphrak
Copy link
Contributor

sphrak commented Jun 19, 2018

Is there a possibility this will be merged into 1.5.0?

@lunny
Copy link
Member Author

lunny commented Jun 19, 2018

@sphrak it's impossible since v1.5 has been freezed. I would like this could be in v1.6.

@sphrak
Copy link
Contributor

sphrak commented Jun 19, 2018

@lunny I understand, thanks for communicating that :-)

@jlelse
Copy link

jlelse commented Sep 12, 2018

Any updates on this? I would like to migrate from SQLite to Postgres and therefor need this feature.

@sphrak
Copy link
Contributor

sphrak commented Oct 23, 2018

Any chance this will be part of 1.7.0?

@cryptix
Copy link
Contributor

cryptix commented Dec 7, 2018

@lunny I'd love to try and test this but can share a little light on the go-yaml/yaml fork situation?

@lunny
Copy link
Member Author

lunny commented Dec 8, 2018

@cryptix you are welcome we need yaml support Gonic name mapping, maybe you could send a PR to yaml at first.

@lunny lunny force-pushed the lunny/dump_restore branch from 9434bc7 to c85526d Compare March 29, 2019 02:54
@dodedodo
Copy link

Any updates on this? Like jlelse I'm trying to do a database migration, and this should make my life so much easier.

@dev-dsp
Copy link

dev-dsp commented Jul 21, 2020

Any updates on this? I would like to migrate from SQLite to Postgres and therefore need this feature.

@dev-dsp
Copy link

dev-dsp commented Jul 21, 2020

For those who are curious about how to migrate data from sqlite to postgresql, see this link: #5651 (comment)

@lunny lunny changed the title Reimplement dump and implment restore command WIP: Reimplement dump and implment restore command Dec 23, 2020
@singuliere
Copy link
Contributor

It looks like this PR is still relevant because the restore process still is manual.

@lunny lunny removed this from the 1.x.x milestone Dec 30, 2022
@yardenshoham
Copy link
Member

This is in progress for a while now, I'm closing it. Please reopen when it's ready for review.

@lunny lunny deleted the lunny/dump_restore branch May 2, 2023 13:28
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.