mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 22:42:24 -05:00 
			
		
		
		
	[chore] Add some log lines to recent migrations warning not to interrupt (#3134)
* [chore] Add some log lines to recent migrations warning not to interrupt * arse
This commit is contained in:
		
					parent
					
						
							
								86a59db711
							
						
					
				
			
			
				commit
				
					
						6533531cf1
					
				
			
		
					 4 changed files with 22 additions and 5 deletions
				
			
		|  | @ -20,11 +20,17 @@ package migrations | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 
 | 
 | ||||||
|  | 	"github.com/superseriousbusiness/gotosocial/internal/log" | ||||||
| 	"github.com/uptrace/bun" | 	"github.com/uptrace/bun" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func init() { | func init() { | ||||||
| 	up := func(ctx context.Context, db *bun.DB) error { | 	up := func(ctx context.Context, db *bun.DB) error { | ||||||
|  | 		log.Info( | ||||||
|  | 			ctx, | ||||||
|  | 			"dropping unused media attachments columns, please wait; "+ | ||||||
|  | 				"this may take a long time if your database has lots of media attachments, don't interrupt it!", | ||||||
|  | 		) | ||||||
| 		return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { | 		return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { | ||||||
| 
 | 
 | ||||||
| 			for _, dropcase := range []struct { | 			for _, dropcase := range []struct { | ||||||
|  |  | ||||||
|  | @ -22,12 +22,18 @@ import ( | ||||||
| 
 | 
 | ||||||
| 	old_gtsmodel "github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations/20240715204203_media_pipeline_improvements" | 	old_gtsmodel "github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations/20240715204203_media_pipeline_improvements" | ||||||
| 	new_gtsmodel "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" | 	new_gtsmodel "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" | ||||||
|  | 	"github.com/superseriousbusiness/gotosocial/internal/log" | ||||||
| 
 | 
 | ||||||
| 	"github.com/uptrace/bun" | 	"github.com/uptrace/bun" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func init() { | func init() { | ||||||
| 	up := func(ctx context.Context, db *bun.DB) error { | 	up := func(ctx context.Context, db *bun.DB) error { | ||||||
|  | 		log.Info( | ||||||
|  | 			ctx, | ||||||
|  | 			"doing media pipeline improvements; "+ | ||||||
|  | 				"this may take a while if your database has lots of media attachments, don't interrupt it!", | ||||||
|  | 		) | ||||||
| 		if err := db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { | 		if err := db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { | ||||||
| 			if _, err := tx.NewAddColumn(). | 			if _, err := tx.NewAddColumn(). | ||||||
| 				Table("media_attachments"). | 				Table("media_attachments"). | ||||||
|  |  | ||||||
|  | @ -21,6 +21,7 @@ import ( | ||||||
| 	"context" | 	"context" | ||||||
| 
 | 
 | ||||||
| 	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" | 	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" | ||||||
|  | 	"github.com/superseriousbusiness/gotosocial/internal/log" | ||||||
| 	"github.com/uptrace/bun" | 	"github.com/uptrace/bun" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | @ -29,6 +30,11 @@ import ( | ||||||
| // Admins may want to vacuum after running this migration. | // Admins may want to vacuum after running this migration. | ||||||
| func init() { | func init() { | ||||||
| 	up := func(ctx context.Context, db *bun.DB) error { | 	up := func(ctx context.Context, db *bun.DB) error { | ||||||
|  | 		log.Info( | ||||||
|  | 			ctx, | ||||||
|  | 			"dropping duplicated status boost data, please wait; "+ | ||||||
|  | 				"this may take a long time if your database has lots of statuses, don't interrupt it!", | ||||||
|  | 		) | ||||||
| 		return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { | 		return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { | ||||||
| 			_, err := tx.NewUpdate(). | 			_, err := tx.NewUpdate(). | ||||||
| 				Model((*gtsmodel.Status)(nil)). | 				Model((*gtsmodel.Status)(nil)). | ||||||
|  |  | ||||||
|  | @ -780,10 +780,10 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() { | ||||||
|   "created_at": "2021-10-20T10:41:37.000Z", |   "created_at": "2021-10-20T10:41:37.000Z", | ||||||
|   "in_reply_to_id": null, |   "in_reply_to_id": null, | ||||||
|   "in_reply_to_account_id": null, |   "in_reply_to_account_id": null, | ||||||
|   "sensitive": true, |   "sensitive": false, | ||||||
|   "spoiler_text": "introduction post", |   "spoiler_text": "", | ||||||
|   "visibility": "public", |   "visibility": "public", | ||||||
|   "language": "en", |   "language": null, | ||||||
|   "uri": "http://localhost:8080/users/admin/statuses/01G36SF3V6Y6V5BF9P4R7PQG7G", |   "uri": "http://localhost:8080/users/admin/statuses/01G36SF3V6Y6V5BF9P4R7PQG7G", | ||||||
|   "url": "http://localhost:8080/@admin/statuses/01G36SF3V6Y6V5BF9P4R7PQG7G", |   "url": "http://localhost:8080/@admin/statuses/01G36SF3V6Y6V5BF9P4R7PQG7G", | ||||||
|   "replies_count": 0, |   "replies_count": 0, | ||||||
|  | @ -794,7 +794,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() { | ||||||
|   "muted": false, |   "muted": false, | ||||||
|   "bookmarked": true, |   "bookmarked": true, | ||||||
|   "pinned": false, |   "pinned": false, | ||||||
|   "content": "hello everyone!", |   "content": "", | ||||||
|   "reblog": { |   "reblog": { | ||||||
|     "id": "01F8MH75CBF9JFX4ZAD54N0W0R", |     "id": "01F8MH75CBF9JFX4ZAD54N0W0R", | ||||||
|     "created_at": "2021-10-20T11:36:45.000Z", |     "created_at": "2021-10-20T11:36:45.000Z", | ||||||
|  | @ -981,7 +981,6 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() { | ||||||
|   "emojis": [], |   "emojis": [], | ||||||
|   "card": null, |   "card": null, | ||||||
|   "poll": null, |   "poll": null, | ||||||
|   "text": "hello everyone!", |  | ||||||
|   "filtered": [ |   "filtered": [ | ||||||
|     { |     { | ||||||
|       "filter": { |       "filter": { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue