小编lif*_*162的帖子

如何在 gitlab 中禁用自动管道

由于 gitlab 限制了 gitlab CI/CD 上的免费层分钟数。我想在提交后禁用我的管道的自动启动。

我只想通过单击 gitlab interface 手动运行管道

我该怎么做?

gitlab gitlab-ci

8
推荐指数
2
解决办法
3884
查看次数

在 typeorm 中创建关系的正确方法是什么?

我有两个实体:

@Entity({ name: 'provider' })
export class ProviderEntity extends GenericEntity {

    @Column()
    name: string;

    @Column()
    description: string;

    @OneToMany(() => ItemEntity, item => item.provider)
    items: Promise<ItemEntity[]>;

}

@Entity({ name: 'item' })
export class ItemEntity extends GenericEntity {

    @Column()
    content: string;

    @ManyToOne(() => ProviderEntity, provider => provider.items)
    provider: Promise<ProviderEntity>;

}
Run Code Online (Sandbox Code Playgroud)

Provider对象已存在于数据库中,我想item使用关系来创建provider.

我的代码是:

        const content = 'mockContent';
        const providerId = '5be045b1-ef49-4818-b69f-a45c0b7e53';
       
        const item = new ItemEntity();
        item.content = content;
        item.provider = providerId; // ERROR

        await this.repository.save(item);
        return item; …
Run Code Online (Sandbox Code Playgroud)

entity-relationship typescript typeorm

5
推荐指数
1
解决办法
1万
查看次数