forked from FoundKeyGang/FoundKey
remove ads from database
This commit is contained in:
parent
402d4e866e
commit
a717fcc70c
4 changed files with 12 additions and 63 deletions
12
packages/backend/migration/1657570176749-remove-ads.ts
Normal file
12
packages/backend/migration/1657570176749-remove-ads.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
export class removeAds1657570176749 {
|
||||||
|
name = 'removeAds1657570176749'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`DROP TABLE "ad"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`CREATE TABLE public.ad ("id" character varying(32) NOT NULL, "createdAt" timestamp with time zone NOT NULL, "expiresAt" timestamp with time zone NOT NULL, "place" character varying(32) NOT NULL, "priority" character varying(32) NOT NULL, "url" character varying(1024) NOT NULL, "imageUrl" character varying(1024) NOT NULL, "memo" character varying(8192) NOT NULL, "ratio" integer DEFAULT 1 NOT NULL)`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -65,7 +65,6 @@ import { Channel } from '@/models/entities/channel.js';
|
||||||
import { ChannelFollowing } from '@/models/entities/channel-following.js';
|
import { ChannelFollowing } from '@/models/entities/channel-following.js';
|
||||||
import { ChannelNotePining } from '@/models/entities/channel-note-pining.js';
|
import { ChannelNotePining } from '@/models/entities/channel-note-pining.js';
|
||||||
import { RegistryItem } from '@/models/entities/registry-item.js';
|
import { RegistryItem } from '@/models/entities/registry-item.js';
|
||||||
import { Ad } from '@/models/entities/ad.js';
|
|
||||||
import { PasswordResetRequest } from '@/models/entities/password-reset-request.js';
|
import { PasswordResetRequest } from '@/models/entities/password-reset-request.js';
|
||||||
import { UserPending } from '@/models/entities/user-pending.js';
|
import { UserPending } from '@/models/entities/user-pending.js';
|
||||||
|
|
||||||
|
@ -168,7 +167,6 @@ export const entities = [
|
||||||
ChannelFollowing,
|
ChannelFollowing,
|
||||||
ChannelNotePining,
|
ChannelNotePining,
|
||||||
RegistryItem,
|
RegistryItem,
|
||||||
Ad,
|
|
||||||
PasswordResetRequest,
|
PasswordResetRequest,
|
||||||
UserPending,
|
UserPending,
|
||||||
Webhook,
|
Webhook,
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
import { Entity, Index, Column, PrimaryColumn } from 'typeorm';
|
|
||||||
import { id } from '../id.js';
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
export class Ad {
|
|
||||||
@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.',
|
|
||||||
})
|
|
||||||
public expiresAt: Date;
|
|
||||||
|
|
||||||
@Column('varchar', {
|
|
||||||
length: 32, nullable: false,
|
|
||||||
})
|
|
||||||
public place: string;
|
|
||||||
|
|
||||||
// 今は使われていないが将来的に活用される可能性はある
|
|
||||||
@Column('varchar', {
|
|
||||||
length: 32, nullable: false,
|
|
||||||
})
|
|
||||||
public priority: string;
|
|
||||||
|
|
||||||
@Column('integer', {
|
|
||||||
default: 1, nullable: false,
|
|
||||||
})
|
|
||||||
public ratio: number;
|
|
||||||
|
|
||||||
@Column('varchar', {
|
|
||||||
length: 1024, nullable: false,
|
|
||||||
})
|
|
||||||
public url: string;
|
|
||||||
|
|
||||||
@Column('varchar', {
|
|
||||||
length: 1024, nullable: false,
|
|
||||||
})
|
|
||||||
public imageUrl: string;
|
|
||||||
|
|
||||||
@Column('varchar', {
|
|
||||||
length: 8192, nullable: false,
|
|
||||||
})
|
|
||||||
public memo: string;
|
|
||||||
|
|
||||||
constructor(data: Partial<Ad>) {
|
|
||||||
if (data == null) return;
|
|
||||||
|
|
||||||
for (const [k, v] of Object.entries(data)) {
|
|
||||||
(this as any)[k] = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -59,7 +59,6 @@ import { MutedNote } from './entities/muted-note.js';
|
||||||
import { ChannelFollowing } from './entities/channel-following.js';
|
import { ChannelFollowing } from './entities/channel-following.js';
|
||||||
import { ChannelNotePining } from './entities/channel-note-pining.js';
|
import { ChannelNotePining } from './entities/channel-note-pining.js';
|
||||||
import { RegistryItem } from './entities/registry-item.js';
|
import { RegistryItem } from './entities/registry-item.js';
|
||||||
import { Ad } from './entities/ad.js';
|
|
||||||
import { PasswordResetRequest } from './entities/password-reset-request.js';
|
import { PasswordResetRequest } from './entities/password-reset-request.js';
|
||||||
import { UserPending } from './entities/user-pending.js';
|
import { UserPending } from './entities/user-pending.js';
|
||||||
import { InstanceRepository } from './repositories/instance.js';
|
import { InstanceRepository } from './repositories/instance.js';
|
||||||
|
@ -126,5 +125,4 @@ export const ChannelFollowings = db.getRepository(ChannelFollowing);
|
||||||
export const ChannelNotePinings = db.getRepository(ChannelNotePining);
|
export const ChannelNotePinings = db.getRepository(ChannelNotePining);
|
||||||
export const RegistryItems = db.getRepository(RegistryItem);
|
export const RegistryItems = db.getRepository(RegistryItem);
|
||||||
export const Webhooks = db.getRepository(Webhook);
|
export const Webhooks = db.getRepository(Webhook);
|
||||||
export const Ads = db.getRepository(Ad);
|
|
||||||
export const PasswordResetRequests = db.getRepository(PasswordResetRequest);
|
export const PasswordResetRequests = db.getRepository(PasswordResetRequest);
|
||||||
|
|
Loading…
Reference in a new issue