serpbear/database/models/keyword.ts
towfiqi 444ba5d461 refactor: Adds Keyword Table migration to add new fields.
- Adds city, latlong and settings fields to Keyword table.
2024-02-04 23:43:13 +06:00

73 lines
2.1 KiB
TypeScript

import { Table, Model, Column, DataType, PrimaryKey } from 'sequelize-typescript';
@Table({
timestamps: false,
tableName: 'keyword',
})
class Keyword extends Model {
@PrimaryKey
@Column({ type: DataType.INTEGER, allowNull: false, primaryKey: true, autoIncrement: true })
ID!: number;
@Column({ type: DataType.STRING, allowNull: false })
keyword!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: 'desktop' })
device!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: 'US' })
country!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: '' })
city!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: '' })
latlong!: string;
@Column({ type: DataType.STRING, allowNull: false, defaultValue: '{}' })
domain!: string;
// @ForeignKey(() => Domain)
// @Column({ allowNull: false })
// domainID!: number;
// @BelongsTo(() => Domain)
// domain!: Domain;
@Column({ type: DataType.STRING, allowNull: true })
lastUpdated!: string;
@Column({ type: DataType.STRING, allowNull: true })
added!: string;
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })
position!: number;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: JSON.stringify([]) })
history!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: JSON.stringify([]) })
url!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: JSON.stringify([]) })
tags!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: JSON.stringify([]) })
lastResult!: string;
@Column({ type: DataType.BOOLEAN, allowNull: true, defaultValue: true })
sticky!: boolean;
@Column({ type: DataType.BOOLEAN, allowNull: true, defaultValue: false })
updating!: boolean;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: 'false' })
lastUpdateError!: string;
@Column({ type: DataType.STRING, allowNull: true })
settings!: string;
}
export default Keyword;