2023-06-22 15:20:04 +00:00
|
|
|
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 {
|
2023-06-22 15:20:04 +00:00
|
|
|
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'
|
|
|
|
// }
|
|
|
|
|
2023-07-17 17:13:30 +00:00
|
|
|
public static get incrementing() {
|
2023-06-22 15:20:04 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// @column({
|
|
|
|
// isPrimary: true,
|
|
|
|
// })
|
|
|
|
// public id: number;
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-06-22 15:20:04 +00:00
|
|
|
// Foreign key is still on the same model
|
2023-03-03 15:54:28 +00:00
|
|
|
@column({})
|
2023-06-22 15:20:04 +00:00
|
|
|
public file_id: number;
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
@column({})
|
2023-06-22 15:20:04 +00:00
|
|
|
public type: string;
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-06-22 15:20:04 +00:00
|
|
|
@column()
|
|
|
|
public value: string;
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
@belongsTo(() => File)
|
2023-06-22 15:20:04 +00:00
|
|
|
public file: BelongsTo<typeof File>;
|
|
|
|
}
|