chore: synchronize code and database schema (#8577)

* chore: remove default null

null is always the default value if a table column is nullable, and typeorm's
@Column only accepts strings for default.

* chore: synchronize code with database schema

* chore: sync generated migrations with code
This commit is contained in:
Johann150
2022-05-05 15:45:22 +02:00
committed by GitHub
parent bd620a8c77
commit 31c73fdfa2
12 changed files with 108 additions and 27 deletions

View File

@ -15,7 +15,6 @@ export class AccessToken {
@Column('timestamp with time zone', {
nullable: true,
default: null,
})
public lastUsedAt: Date | null;
@ -29,7 +28,6 @@ export class AccessToken {
@Column('varchar', {
length: 128,
nullable: true,
default: null,
})
public session: string | null;
@ -52,7 +50,6 @@ export class AccessToken {
@Column({
...id(),
nullable: true,
default: null,
})
public appId: App['id'] | null;
@ -65,21 +62,18 @@ export class AccessToken {
@Column('varchar', {
length: 128,
nullable: true,
default: null,
})
public name: string | null;
@Column('varchar', {
length: 512,
nullable: true,
default: null,
})
public description: string | null;
@Column('varchar', {
length: 512,
nullable: true,
default: null,
})
public iconUrl: string | null;

View File

@ -23,7 +23,7 @@ export class AuthSession {
...id(),
nullable: true,
})
public userId: User['id'];
public userId: User['id'] | null;
@ManyToOne(type => User, {
onDelete: 'CASCADE',

View File

@ -37,7 +37,7 @@ export class Clip {
public isPublic: boolean;
@Column('varchar', {
length: 2048, nullable: true, default: null,
length: 2048, nullable: true,
comment: 'The description of the Clip.',
})
public description: string | null;

View File

@ -79,7 +79,6 @@ export class DriveFile {
})
public properties: { width?: number; height?: number; orientation?: number; avgColor?: string };
@Index()
@Column('boolean')
public storedInternal: boolean;

View File

@ -36,6 +36,7 @@ export class Emoji {
@Column('varchar', {
length: 512,
default: '',
})
public publicUrl: string;

View File

@ -107,53 +107,53 @@ export class Instance {
public isSuspended: boolean;
@Column('varchar', {
length: 64, nullable: true, default: null,
length: 64, nullable: true,
comment: 'The software of the Instance.',
})
public softwareName: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
length: 64, nullable: true,
})
public softwareVersion: string | null;
@Column('boolean', {
nullable: true, default: null,
nullable: true,
})
public openRegistrations: boolean | null;
@Column('varchar', {
length: 256, nullable: true, default: null,
length: 256, nullable: true,
})
public name: string | null;
@Column('varchar', {
length: 4096, nullable: true, default: null,
length: 4096, nullable: true,
})
public description: string | null;
@Column('varchar', {
length: 128, nullable: true, default: null,
length: 128, nullable: true,
})
public maintainerName: string | null;
@Column('varchar', {
length: 256, nullable: true, default: null,
length: 256, nullable: true,
})
public maintainerEmail: string | null;
@Column('varchar', {
length: 256, nullable: true, default: null,
length: 256, nullable: true,
})
public iconUrl: string | null;
@Column('varchar', {
length: 256, nullable: true, default: null,
length: 256, nullable: true,
})
public faviconUrl: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
length: 64, nullable: true,
})
public themeColor: string | null;

View File

@ -78,7 +78,7 @@ export class Meta {
public blockedHosts: string[];
@Column('varchar', {
length: 512, array: true, default: '{"/featured", "/channels", "/explore", "/pages", "/about-misskey"}',
length: 512, array: true, default: '{/featured,/channels,/explore,/pages,/about-misskey}',
})
public pinnedPages: string[];
@ -346,14 +346,12 @@ export class Meta {
@Column('varchar', {
length: 8192,
default: null,
nullable: true,
})
public defaultLightTheme: string | null;
@Column('varchar', {
length: 8192,
default: null,
nullable: true,
})
public defaultDarkTheme: string | null;

View File

@ -17,7 +17,6 @@ export class Muting {
@Index()
@Column('timestamp with time zone', {
nullable: true,
default: null,
})
public expiresAt: Date | null;

View File

@ -53,8 +53,8 @@ export class Note {
})
public threadId: string | null;
@Column('varchar', {
length: 8192, nullable: true,
@Column('text', {
nullable: true,
})
public text: string | null;
@ -179,7 +179,7 @@ export class Note {
@Index()
@Column({
...id(),
nullable: true, default: null,
nullable: true,
comment: 'The ID of source channel.',
})
public channelId: Channel['id'] | null;

View File

@ -192,6 +192,7 @@ export class UserProfile {
@Column('jsonb', {
default: [],
comment: 'List of instances muted by the user.',
})
public mutedInstances: string[];

View File

@ -207,7 +207,7 @@ export class User {
@Column('boolean', {
default: false,
comment: 'Whether to show users replying to other users in the timeline',
comment: 'Whether to show users replying to other users in the timeline.',
})
public showTimelineReplies: boolean;