[chore] Migrate accounts to new table, relax uniqueness constraint of actor url and collections (#3928)

* [chore] Migrate accounts to new table, relax uniqueness constraint of actor url and collections

* fiddle with it! (that's what she said)

* remove unused cache fields

* sillyness

* fix tiny whoopsie
This commit is contained in:
tobi
2025-04-06 14:39:40 +02:00
committed by GitHub
parent 650be1e8d0
commit 8ae2440da3
43 changed files with 1298 additions and 566 deletions

View File

@@ -292,104 +292,63 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
accounts := map[string]*gtsmodel.Account{
"instance_account": {
ID: "01AY6P665V14JJR0AFVRT7311Y",
Username: "localhost:8080",
AvatarMediaAttachmentID: "",
HeaderMediaAttachmentID: "",
DisplayName: "",
Fields: []*gtsmodel.Field{},
Note: "",
NoteRaw: "",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2020-05-17T13:10:59Z"),
UpdatedAt: TimeMustParse("2020-05-17T13:10:59Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(false),
Discoverable: util.Ptr(true),
URI: "http://localhost:8080/users/localhost:8080",
URL: "http://localhost:8080/@localhost:8080",
PublicKeyURI: "http://localhost:8080/users/localhost:8080#main-key",
FetchedAt: time.Time{},
InboxURI: "http://localhost:8080/users/localhost:8080/inbox",
OutboxURI: "http://localhost:8080/users/localhost:8080/outbox",
FollowersURI: "http://localhost:8080/users/localhost:8080/followers",
FollowingURI: "http://localhost:8080/users/localhost:8080/following",
FeaturedCollectionURI: "http://localhost:8080/users/localhost:8080/collections/featured",
ActorType: ap.ActorPerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
ID: "01AY6P665V14JJR0AFVRT7311Y",
Username: "localhost:8080",
CreatedAt: TimeMustParse("2020-05-17T13:10:59Z"),
UpdatedAt: TimeMustParse("2020-05-17T13:10:59Z"),
Locked: util.Ptr(false),
Discoverable: util.Ptr(true),
URI: "http://localhost:8080/users/localhost:8080",
URL: "http://localhost:8080/@localhost:8080",
PublicKeyURI: "http://localhost:8080/users/localhost:8080#main-key",
InboxURI: "http://localhost:8080/users/localhost:8080/inbox",
OutboxURI: "http://localhost:8080/users/localhost:8080/outbox",
FollowersURI: "http://localhost:8080/users/localhost:8080/followers",
FollowingURI: "http://localhost:8080/users/localhost:8080/following",
FeaturedCollectionURI: "http://localhost:8080/users/localhost:8080/collections/featured",
ActorType: gtsmodel.AccountActorTypeService,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
},
"unconfirmed_account": {
ID: "01F8MH0BBE4FHXPH513MBVFHB0",
Username: "weed_lord420",
AvatarMediaAttachmentID: "",
HeaderMediaAttachmentID: "",
DisplayName: "",
Fields: []*gtsmodel.Field{},
Note: "",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(false),
Discoverable: util.Ptr(false),
URI: "http://localhost:8080/users/weed_lord420",
URL: "http://localhost:8080/@weed_lord420",
FetchedAt: time.Time{},
InboxURI: "http://localhost:8080/users/weed_lord420/inbox",
OutboxURI: "http://localhost:8080/users/weed_lord420/outbox",
FollowersURI: "http://localhost:8080/users/weed_lord420/followers",
FollowingURI: "http://localhost:8080/users/weed_lord420/following",
FeaturedCollectionURI: "http://localhost:8080/users/weed_lord420/collections/featured",
ActorType: ap.ActorPerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "http://localhost:8080/users/weed_lord420#main-key",
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
Settings: settings["unconfirmed_account"],
ID: "01F8MH0BBE4FHXPH513MBVFHB0",
Username: "weed_lord420",
CreatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
Locked: util.Ptr(false),
Discoverable: util.Ptr(false),
URI: "http://localhost:8080/users/weed_lord420",
URL: "http://localhost:8080/@weed_lord420",
InboxURI: "http://localhost:8080/users/weed_lord420/inbox",
OutboxURI: "http://localhost:8080/users/weed_lord420/outbox",
FollowersURI: "http://localhost:8080/users/weed_lord420/followers",
FollowingURI: "http://localhost:8080/users/weed_lord420/following",
FeaturedCollectionURI: "http://localhost:8080/users/weed_lord420/collections/featured",
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "http://localhost:8080/users/weed_lord420#main-key",
Settings: settings["unconfirmed_account"],
},
"admin_account": {
ID: "01F8MH17FWEB39HZJ76B6VXSKF",
Username: "admin",
AvatarMediaAttachmentID: "",
HeaderMediaAttachmentID: "",
DisplayName: "",
Fields: []*gtsmodel.Field{},
Note: "",
NoteRaw: "",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2022-05-17T13:10:59Z"),
UpdatedAt: TimeMustParse("2022-05-17T13:10:59Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(false),
Discoverable: util.Ptr(true),
URI: "http://localhost:8080/users/admin",
URL: "http://localhost:8080/@admin",
PublicKeyURI: "http://localhost:8080/users/admin#main-key",
FetchedAt: time.Time{},
InboxURI: "http://localhost:8080/users/admin/inbox",
OutboxURI: "http://localhost:8080/users/admin/outbox",
FollowersURI: "http://localhost:8080/users/admin/followers",
FollowingURI: "http://localhost:8080/users/admin/following",
FeaturedCollectionURI: "http://localhost:8080/users/admin/collections/featured",
ActorType: ap.ActorPerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
Settings: settings["admin_account"],
ID: "01F8MH17FWEB39HZJ76B6VXSKF",
Username: "admin",
CreatedAt: TimeMustParse("2022-05-17T13:10:59Z"),
UpdatedAt: TimeMustParse("2022-05-17T13:10:59Z"),
Locked: util.Ptr(false),
Discoverable: util.Ptr(true),
URI: "http://localhost:8080/users/admin",
URL: "http://localhost:8080/@admin",
PublicKeyURI: "http://localhost:8080/users/admin#main-key",
InboxURI: "http://localhost:8080/users/admin/inbox",
OutboxURI: "http://localhost:8080/users/admin/outbox",
FollowersURI: "http://localhost:8080/users/admin/followers",
FollowingURI: "http://localhost:8080/users/admin/following",
FeaturedCollectionURI: "http://localhost:8080/users/admin/collections/featured",
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
Settings: settings["admin_account"],
},
"local_account_1": {
ID: "01F8MH1H7YV1Z7D2C8K2730QBF",
@@ -397,40 +356,29 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
AvatarMediaAttachmentID: "01F8MH58A357CV5K7R7TJMSH6S",
HeaderMediaAttachmentID: "01PFPMWK2FF0D9WMHEJHR07C3Q",
DisplayName: "original zork (he/they)",
Fields: []*gtsmodel.Field{},
Note: "<p>hey yo this is my profile!</p>",
NoteRaw: "hey yo this is my profile!",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2022-05-20T11:09:18Z"),
UpdatedAt: TimeMustParse("2022-05-20T11:09:18Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(false),
Discoverable: util.Ptr(true),
URI: "http://localhost:8080/users/the_mighty_zork",
URL: "http://localhost:8080/@the_mighty_zork",
FetchedAt: time.Time{},
InboxURI: "http://localhost:8080/users/the_mighty_zork/inbox",
OutboxURI: "http://localhost:8080/users/the_mighty_zork/outbox",
FollowersURI: "http://localhost:8080/users/the_mighty_zork/followers",
FollowingURI: "http://localhost:8080/users/the_mighty_zork/following",
FeaturedCollectionURI: "http://localhost:8080/users/the_mighty_zork/collections/featured",
ActorType: ap.ActorPerson,
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "http://localhost:8080/users/the_mighty_zork/main-key",
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
Settings: settings["local_account_1"],
},
"local_account_2": {
ID: "01F8MH5NBDF2MV7CTC4Q5128HF",
Username: "1happyturtle",
AvatarMediaAttachmentID: "",
HeaderMediaAttachmentID: "",
DisplayName: "happy little turtle :3",
ID: "01F8MH5NBDF2MV7CTC4Q5128HF",
Username: "1happyturtle",
DisplayName: "happy little turtle :3",
Fields: []*gtsmodel.Field{
{
Name: "should you follow me?",
@@ -453,29 +401,21 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
},
Note: "<p>i post about things that concern me</p>",
NoteRaw: "i post about things that concern me",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(true),
Discoverable: util.Ptr(false),
URI: "http://localhost:8080/users/1happyturtle",
URL: "http://localhost:8080/@1happyturtle",
FetchedAt: time.Time{},
InboxURI: "http://localhost:8080/users/1happyturtle/inbox",
OutboxURI: "http://localhost:8080/users/1happyturtle/outbox",
FollowersURI: "http://localhost:8080/users/1happyturtle/followers",
FollowingURI: "http://localhost:8080/users/1happyturtle/following",
FeaturedCollectionURI: "http://localhost:8080/users/1happyturtle/collections/featured",
ActorType: ap.ActorPerson,
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "http://localhost:8080/users/1happyturtle#main-key",
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
Settings: settings["local_account_2"],
},
"local_account_3": {
@@ -483,7 +423,6 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
Username: "media_mogul",
AvatarMediaAttachmentID: "01JPHQZ0ZHC2AXJK1JQNXRXQZN",
HeaderMediaAttachmentID: "01JPHRB7F2RXPTEQFRYC85EPD9",
DisplayName: "",
Fields: []*gtsmodel.Field{
{
Name: "I'm going to post a lot of",
@@ -506,29 +445,21 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
},
Note: "<p>I'm a test account that posts a shitload of media and I have my account rendered in \"gallery\" mode</p>",
NoteRaw: "I'm a test account that posts a shitload of media and I have my account rendered in \"gallery\" mode",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2025-03-15T11:08:00Z"),
UpdatedAt: TimeMustParse("2025-03-15T11:08:00Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(false),
Discoverable: util.Ptr(false),
URI: "http://localhost:8080/users/media_mogul",
URL: "http://localhost:8080/@media_mogul",
FetchedAt: time.Time{},
InboxURI: "http://localhost:8080/users/media_mogul/inbox",
OutboxURI: "http://localhost:8080/users/media_mogul/outbox",
FollowersURI: "http://localhost:8080/users/media_mogul/followers",
FollowingURI: "http://localhost:8080/users/media_mogul/following",
FeaturedCollectionURI: "http://localhost:8080/users/media_mogul/collections/featured",
ActorType: ap.ActorPerson,
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "http://localhost:8080/users/media_mogul#main-key",
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
Settings: settings["local_account_3"],
},
"remote_account_1": {
@@ -536,129 +467,92 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
Username: "foss_satan",
Domain: "fossbros-anonymous.io",
DisplayName: "big gerald",
Fields: []*gtsmodel.Field{},
Note: "i post about like, i dunno, stuff, or whatever!!!!",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2021-09-26T12:52:36+02:00"),
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(false),
Discoverable: util.Ptr(true),
URI: "http://fossbros-anonymous.io/users/foss_satan",
URL: "http://fossbros-anonymous.io/@foss_satan",
FetchedAt: time.Time{},
InboxURI: "http://fossbros-anonymous.io/users/foss_satan/inbox",
SharedInboxURI: util.Ptr("http://fossbros-anonymous.io/inbox"),
OutboxURI: "http://fossbros-anonymous.io/users/foss_satan/outbox",
FollowersURI: "http://fossbros-anonymous.io/users/foss_satan/followers",
FollowingURI: "http://fossbros-anonymous.io/users/foss_satan/following",
FeaturedCollectionURI: "http://fossbros-anonymous.io/users/foss_satan/collections/featured",
ActorType: ap.ActorPerson,
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "http://fossbros-anonymous.io/users/foss_satan/main-key",
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
},
"remote_account_2": {
ID: "01FHMQX3GAABWSM0S2VZEC2SWC",
Username: "Some_User",
Domain: "example.org",
DisplayName: "some user",
Fields: []*gtsmodel.Field{},
Note: "i'm a real son of a gun",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2020-08-10T14:13:28+02:00"),
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(true),
Discoverable: util.Ptr(true),
URI: "http://example.org/users/Some_User",
URL: "http://example.org/@Some_User",
FetchedAt: time.Time{},
InboxURI: "http://example.org/users/Some_User/inbox",
SharedInboxURI: util.Ptr(""),
OutboxURI: "http://example.org/users/Some_User/outbox",
FollowersURI: "http://example.org/users/Some_User/followers",
FollowingURI: "http://example.org/users/Some_User/following",
FeaturedCollectionURI: "http://example.org/users/Some_User/collections/featured",
ActorType: ap.ActorPerson,
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "http://example.org/users/Some_User#main-key",
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
},
"remote_account_3": {
ID: "062G5WYKY35KKD12EMSM3F8PJ8",
Username: "her_fuckin_maj",
Domain: "thequeenisstillalive.technology",
DisplayName: "lizzzieeeeeeeeeeee",
Fields: []*gtsmodel.Field{},
Note: "if i die blame charles don't let that fuck become king",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2020-08-10T14:13:28+02:00"),
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(true),
Discoverable: util.Ptr(true),
URI: "http://thequeenisstillalive.technology/users/her_fuckin_maj",
URL: "http://thequeenisstillalive.technology/@her_fuckin_maj",
FetchedAt: time.Time{},
InboxURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/inbox",
SharedInboxURI: util.Ptr(""),
OutboxURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/outbox",
FollowersURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/followers",
FollowingURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/following",
FeaturedCollectionURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj/collections/featured",
ActorType: ap.ActorPerson,
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "http://thequeenisstillalive.technology/users/her_fuckin_maj#main-key",
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
HeaderMediaAttachmentID: "01PFPMWK2FF0D9WMHEJHR07C3R",
},
"remote_account_4": {
ID: "07GZRBAEMBNKGZ8Z9VSKSXKR98",
Username: "üser",
Domain: "xn--xample-ova.org",
DisplayName: "",
Note: "",
Memorial: util.Ptr(false),
MovedToURI: "",
CreatedAt: TimeMustParse("2020-08-10T14:13:28+02:00"),
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
Bot: util.Ptr(false),
Locked: util.Ptr(false),
Discoverable: util.Ptr(false),
URI: "https://xn--xample-ova.org/users/%C3%BCser",
URL: "https://xn--xample-ova.org/users/@%C3%BCser",
FetchedAt: time.Time{},
InboxURI: "https://xn--xample-ova.org/users/%C3%BCser/inbox",
SharedInboxURI: util.Ptr(""),
OutboxURI: "https://xn--xample-ova.org/users/%C3%BCser/outbox",
FollowersURI: "https://xn--xample-ova.org/users/%C3%BCser/followers",
FollowingURI: "https://xn--xample-ova.org/users/%C3%BCser/following",
FeaturedCollectionURI: "https://xn--xample-ova.org/users/%C3%BCser/collections/featured",
ActorType: ap.ActorPerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "https://xn--xample-ova.org/users/%C3%BCser#main-key",
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
SuspensionOrigin: "",
HeaderMediaAttachmentID: "",
ID: "07GZRBAEMBNKGZ8Z9VSKSXKR98",
Username: "üser",
Domain: "xn--xample-ova.org",
CreatedAt: TimeMustParse("2020-08-10T14:13:28+02:00"),
UpdatedAt: TimeMustParse("2022-06-04T13:12:00Z"),
Locked: util.Ptr(false),
Discoverable: util.Ptr(false),
URI: "https://xn--xample-ova.org/users/%C3%BCser",
URL: "https://xn--xample-ova.org/users/@%C3%BCser",
FetchedAt: time.Time{},
InboxURI: "https://xn--xample-ova.org/users/%C3%BCser/inbox",
SharedInboxURI: util.Ptr(""),
OutboxURI: "https://xn--xample-ova.org/users/%C3%BCser/outbox",
FollowersURI: "https://xn--xample-ova.org/users/%C3%BCser/followers",
FollowingURI: "https://xn--xample-ova.org/users/%C3%BCser/following",
FeaturedCollectionURI: "https://xn--xample-ova.org/users/%C3%BCser/collections/featured",
ActorType: gtsmodel.AccountActorTypePerson,
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
PublicKeyURI: "https://xn--xample-ova.org/users/%C3%BCser#main-key",
},
}