Why column not exist?

Пытаюсь выполнить такой код, но получаю ошибку, что такого столбца нет, хотя в в модели он есть

let projects = await this.projectRepository.sequelize
            .query(`SELECT * FROM project WHERE specilizationId = 2 `)


import {BelongsTo, Column, DataType, ForeignKey, Model, Table} from "sequelize-typescript";
import {User} from "../user/user.model";
import {Specialization} from "../specialization/specialization.model";

interface ProjectCreateAttr {
    title: string;
    description: string;
    minCost: number;
    maxCost: number;
    isCostNegotiable: boolean;
    author: User;
    authorId: number;
    specialization: Specialization;
    specializationId: number;
}

@Table({tableName: 'project'})
export class Project extends Model<Project, ProjectCreateAttr> {

    @Column({type: DataType.BIGINT, unique: true, autoIncrement: true, primaryKey: true})
    id: number;

    @Column({type: DataType.STRING, allowNull: false})
    title: string;

    @Column({type: DataType.STRING, allowNull: false})
    description: string;

    @Column({type: DataType.INTEGER, allowNull: true})
    minCost: number;

    @Column({type: DataType.INTEGER, allowNull: true})
    maxCost: number;

    @Column({type: DataType.BOOLEAN, allowNull: false, defaultValue: true})
    isCostNegotiable: boolean;

    @BelongsTo(() => User)
    author: User;

    @ForeignKey(() => User)
    @Column({ type: DataType.BIGINT, allowNull: false})
    authorId: number;

    @BelongsTo(() => Specialization)
    specialization: Specialization;

    @ForeignKey(() => Specialization)
    @Column({ type: DataType.BIGINT, allowNull: false })
    specializationId: number;
}


import {Column, DataType, Model, Table} from "sequelize-typescript";

interface ISpecializationCreateAttr {
    id: number;
    name: string;
}

@Table({ tableName: 'specialization'})
export class Specialization extends Model<Specialization, ISpecializationCreateAttr> {

    @Column({ type: DataType.BIGINT, unique: true, autoIncrement: true, primaryKey: true })
    id: number;

    @Column({ type: DataType.STRING, unique: true, allowNull: false })
    name: string;
}
  • Вопрос задан
  • 86 просмотров
Пригласить эксперта
Ответы на вопрос 1
@historydev
Острая аллергия на анимешников
Вот я сразу увидел, а вы увидите?)
specilizationId

specializationId
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы