tethys.backend/database/migrations/files_2_file_hashvalues.ts
Arno Kaimbacher 4714dfdd94 - use latest prettier 3.0 with eslint-plugin-prettier: 5.0.0-alpha.2
- npm normal updates
- add all xslt and style asstes in extra folder public/assets2
- linting corrections
- delete local .env.test from git tracking: git rm --cached .env.test
- add .env.test into .gitignore file
- add edit functionality for editing by submitter
- npm updates
-added xslt3 packeage for builfing sef files
- added Language.ts class vor language table
- added version to datasetxml2oai-pmh.xslt
2023-07-17 19:13:30 +02:00

39 lines
1.3 KiB
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema';
export default class FileHashvalues extends BaseSchema {
protected tableName = 'file_hashvalues';
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.integer('file_id').notNullable();
table
.foreign('file_id', 'file_hashvalues_file_id_foreign')
.references('id')
.inTable('document_files')
.onDelete('CASCADE') // delete this when document_file is deleted
.onUpdate('CASCADE');
table.string('type', 50).notNullable();
table.string('value').notNullable();
table.primary(['file_id', 'type']);
});
}
public async down() {
this.schema.dropTable(this.tableName);
}
}
// -- Table: file_hashvalues
// CREATE TABLE IF NOT EXISTS file_hashvalues
// (
// file_id integer NOT NULL,
// type character varying(50) NOT NULL,
// value character varying(255) NOT NULL,
// CONSTRAINT file_hashvalues_pkey PRIMARY KEY (file_id, type),
// CONSTRAINT file_hashvalues_file_id_foreign FOREIGN KEY (file_id)
// REFERENCES document_files (id) MATCH SIMPLE
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )