-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
Import export #194
Import export #194
Conversation
internal/trans/exportminimal.go
Outdated
} | ||
|
||
// export all follow requests that relate to local accounts | ||
frs, err := e.exportFollowRequests(ctx, localAccounts, f) |
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.
might be a bit easier to read as followRequests
, and fit with the naming scheme used among the rest of the function :p
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.
changed
internal/trans/exportminimal.go
Outdated
return errors.New("ExportMinimal: path empty") | ||
} | ||
|
||
f, err := os.Create(path) |
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.
again might be easier to read among the rest of the function if it was file
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.
changed
) | ||
|
||
// Account represents the minimum viable representation of an account for export/import. | ||
type Account struct { |
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.
You know my opinion on the second set of models under trans/model
:p
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.
Yes :D I think this is one we'll have to have a proper discussion about. I started typing something up here but maybe we need a little design meeting or something for this one.
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.
official GtS development meetings... I wonder if #GtSDev will end up like #mastodev :D. for real though having a chat about this in matrix maybe this weekend sounds good, I'm sure @f0x52 will have some thoughts too
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.
just people talking about piss all the time you mean? i hope so
@@ -35,3 +36,65 @@ func whereEmptyOrNull(column string) func(*bun.SelectQuery) *bun.SelectQuery { | |||
WhereOr("? = ''", bun.Ident(column)) | |||
} | |||
} | |||
|
|||
// updateWhere parses []db.Where and adds it to the given update query. | |||
func updateWhere(q *bun.UpdateQuery, where []db.Where) { |
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.
While these helper functions do make things neater, I do worry a bit that we're abstracting away the SQL too much. Narrowing down SQL errors when porting SQLite was very difficult. Though maybe a rethink on this is best saved for another PR?
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.
I know what you mean. For now I just updated them a bit because I had to add the 'not' functionality. But in the future I'd actually like to obsolete these 'basic' db interface functions and do everything through per-struct methods instead, if possible. Then we can get as creative with the SQL as we like behind the db interface
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
update bun library -> v1.0.4
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Update oauth library -> v4.3.2-SSB
Update/sqlite library
This PR adds functionality to the command line interface for exporting and importing instance data, so that database migrations can be performed on prerelease versions, or data can be backed up and moved to a different database or machine.
Most of the logic for this functionality is in the
internal/trans
package.From the docs:
What will be kept:
What will be dropped:
The backup file produced will be in the form of a line-separated series of JSON objects (not a JSON array!). The reason for this is that GtS streams entries to the file one-by-one to keep memory use low, rather than building up a whole picture of the file and then writing it out all at once.
The file looks like this (small snippet example):
The PR also contains some additional little fixes and tweaks and test changes that were needed along the way.
Closes #188