tethys.backend/database/migrations/files_1_document_files.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

58 lines
2.2 KiB
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema';
export default class DocumentFiles extends BaseSchema {
protected tableName = 'document_files';
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary().defaultTo("nextval('document_files_id_seq')");
table.integer('document_id').unsigned().notNullable();
table
.foreign('document_id', 'document_files_document_id_foreign')
.references('id')
.inTable('documents')
.onDelete('CASCADE') // delete this when document is deleted
.onUpdate('CASCADE');
table.string('path_name').notNullable();
table.string('label');
table.string('comment');
table.string('mime_type');
table.string('language');
table.bigInteger('file_size').notNullable();
table.boolean('visible_in_frontdoor').notNullable().defaultTo(true);
table.boolean('visible_in_oai').notNullable().defaultTo(true);
table.integer('sort_order').notNullable();
table.timestamp('created_at');
table.timestamp('updated_at');
});
}
public async down() {
this.schema.dropTable(this.tableName);
}
}
// -- Table: document_files
// CREATE TABLE IF NOT EXISTS document_files
// (
// id integer NOT NULL DEFAULT nextval('document_files_id_seq'::regclass),
// document_id integer NOT NULL,
// path_name character varying(100) NOT NULL,
// label character varying(100),
// comment character varying(255),
// mime_type character varying(255),
// language character varying(3),
// file_size bigint NOT NULL,
// visible_in_frontdoor boolean NOT NULL DEFAULT true,
// visible_in_oai boolean NOT NULL DEFAULT true,
// sort_order integer NOT NULL,
// created_at timestamp(0) without time zone,
// updated_at timestamp(0) without time zone,
// CONSTRAINT document_files_pkey PRIMARY KEY (id),
// CONSTRAINT document_files_document_id_foreign FOREIGN KEY (document_id)
// REFERENCES documents (id) MATCH SIMPLE
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )