tethys.backend/app/models/hash_value.ts

36 lines
906 B
TypeScript
Raw Permalink Normal View History

2024-03-14 19:25:27 +00:00
import { column, BaseModel, belongsTo, SnakeCaseNamingStrategy } from '@adonisjs/lucid/orm';
import File from './file.js';
2024-03-14 19:25:27 +00:00
import type { BelongsTo } from "@adonisjs/lucid/types/relations";
2023-03-03 15:54:28 +00:00
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
@column({ isPrimary: true })
public file_id: number;
2023-03-03 15:54:28 +00:00
@column({ isPrimary: true })
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>;
}