tethys.backend/app/Models/HashValue.ts

35 lines
814 B
TypeScript
Raw Normal View History

import { column, BaseModel, belongsTo, BelongsTo, SnakeCaseNamingStrategy } from '@ioc:Adonis/Lucid/Orm';
2023-03-03 15:54:28 +00:00
import File from './File';
export default class HashValue extends BaseModel {
public static namingStrategy = new SnakeCaseNamingStrategy();
public static primaryKey = 'file_id, type';
public static table = 'file_hashvalues';
2023-03-03 15:54:28 +00:00
// static get primaryKey () {
// return 'type, value'
// }
public static get incrementing() {
return false;
}
// @column({
// isPrimary: true,
// })
// public id: number;
2023-03-03 15:54:28 +00:00
// Foreign key is still on the same model
2023-03-03 15:54:28 +00:00
@column({})
public file_id: number;
2023-03-03 15:54:28 +00:00
@column({})
public type: string;
2023-03-03 15:54:28 +00:00
@column()
public value: string;
2023-03-03 15:54:28 +00:00
@belongsTo(() => File)
public file: BelongsTo<typeof File>;
}