perf(backend): createdAtをidから取得するように & 無駄なDateインスタンスの生成を避けるように

This commit is contained in:
syuilo
2023-10-16 10:45:22 +09:00
parent 15706c8c2b
commit 1fa1d31696
171 changed files with 442 additions and 537 deletions

View File

@@ -12,12 +12,6 @@ export class MiAbuseUserReport {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the AbuseUserReport.',
})
public createdAt: Date;
@Index()
@Column(id())
public targetUserId: MiUser['id'];

View File

@@ -13,11 +13,6 @@ export class MiAccessToken {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the AccessToken.',
})
public createdAt: Date;
@Column('timestamp with time zone', {
nullable: true,
})

View File

@@ -11,12 +11,6 @@ export class MiAd {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Ad.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
comment: 'The expired date of the Ad.',

View File

@@ -12,12 +12,6 @@ export class MiAnnouncement {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Announcement.',
})
public createdAt: Date;
@Column('timestamp with time zone', {
comment: 'The updated date of the Announcement.',
nullable: true,

View File

@@ -14,11 +14,6 @@ export class MiAnnouncementRead {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the AnnouncementRead.',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,11 +13,6 @@ export class MiAntenna {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the Antenna.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone')
public lastUsedAt: Date;

View File

@@ -12,12 +12,6 @@ export class MiApp {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the App.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -13,11 +13,6 @@ export class MiAuthSession {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the AuthSession.',
})
public createdAt: Date;
@Index()
@Column('varchar', {
length: 128,

View File

@@ -13,12 +13,6 @@ export class MiBlocking {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Blocking.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -13,12 +13,6 @@ export class MiChannel {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Channel.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -14,12 +14,6 @@ export class MiChannelFavorite {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the ChannelFavorite.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,12 +14,6 @@ export class MiChannelFollowing {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the ChannelFollowing.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -12,11 +12,6 @@ export class MiClip {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the Clip.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -14,9 +14,6 @@ export class MiClipFavorite {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone')
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -14,12 +14,6 @@ export class MiDriveFile {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the DriveFile.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -12,12 +12,6 @@ export class MiDriveFolder {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the DriveFolder.',
})
public createdAt: Date;
@Column('varchar', {
length: 128,
comment: 'The name of the DriveFolder.',

View File

@@ -12,12 +12,6 @@ export class MiFlash {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Flash.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
comment: 'The updated date of the Flash.',

View File

@@ -14,9 +14,6 @@ export class MiFlashLike {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone')
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,11 +13,6 @@ export class MiFollowRequest {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the FollowRequest.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,12 +14,6 @@ export class MiFollowing {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Following.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,9 +14,6 @@ export class MiGalleryLike {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone')
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,12 +13,6 @@ export class MiGalleryPost {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the GalleryPost.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
comment: 'The updated date of the GalleryPost.',

View File

@@ -12,11 +12,6 @@ export class MiModerationLog {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the ModerationLog.',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,12 +13,6 @@ export class MiMuting {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Muting.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -18,11 +18,6 @@ export class MiNote {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the Note.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,11 +14,6 @@ export class MiNoteFavorite {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the NoteFavorite.',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -14,11 +14,6 @@ export class MiNoteReaction {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the NoteReaction.',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,10 +13,6 @@ export class MiNoteThreadMuting {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,12 +14,6 @@ export class MiPage {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Page.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
comment: 'The updated date of the Page.',

View File

@@ -14,9 +14,6 @@ export class MiPageLike {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone')
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -12,9 +12,6 @@ export class MiPasswordResetRequest {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone')
public createdAt: Date;
@Index({ unique: true })
@Column('varchar', {
length: 256,

View File

@@ -14,12 +14,6 @@ export class MiPollVote {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the PollVote.',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -14,11 +14,6 @@ export class MiPromoRead {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the PromoRead.',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -23,9 +23,6 @@ export class MiRegistrationTicket {
})
public expiresAt: Date | null;
@Column('timestamp with time zone')
public createdAt: Date;
@ManyToOne(type => MiUser, {
onDelete: 'CASCADE',
})

View File

@@ -13,11 +13,6 @@ export class MiRegistryItem {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the RegistryItem.',
})
public createdAt: Date;
@Column('timestamp with time zone', {
comment: 'The updated date of the RegistryItem.',
})

View File

@@ -13,12 +13,6 @@ export class MiRenoteMuting {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the Muting.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -89,11 +89,6 @@ export class MiRole {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the Role.',
})
public createdAt: Date;
@Column('timestamp with time zone', {
comment: 'The updated date of the Role.',
})

View File

@@ -14,11 +14,6 @@ export class MiRoleAssignment {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the RoleAssignment.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -12,11 +12,6 @@ export class MiSignin {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the Signin.',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -12,9 +12,6 @@ export class MiSwSubscription {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone')
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -13,12 +13,6 @@ export class MiUser {
@PrimaryColumn(id())
public id: string;
@Index()
@Column('timestamp with time zone', {
comment: 'The created date of the User.',
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,

View File

@@ -12,11 +12,6 @@ export class MiUserList {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the UserList.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,9 +14,6 @@ export class MiUserListFavorite {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone')
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -14,11 +14,6 @@ export class MiUserListMembership {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the UserListMembership.',
})
public createdAt: Date;
@Index()
@Column({
...id(),

View File

@@ -14,11 +14,6 @@ export class MiUserNotePining {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the UserNotePinings.',
})
public createdAt: Date;
@Index()
@Column(id())
public userId: MiUser['id'];

View File

@@ -11,9 +11,6 @@ export class MiUserPending {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone')
public createdAt: Date;
@Index({ unique: true })
@Column('varchar', {
length: 128,

View File

@@ -14,11 +14,6 @@ export class MiWebhook {
@PrimaryColumn(id())
public id: string;
@Column('timestamp with time zone', {
comment: 'The created date of the Antenna.',
})
public createdAt: Date;
@Index()
@Column({
...id(),