tethys.backend/database/migrations/dataset_3_abstracts.ts
Arno Kaimbacher 4714dfdd94
All checks were successful
CI Pipeline / japa-tests (push) Successful in 46s
- 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

45 lines
1.9 KiB
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema';
import { DescriptionTypes } from 'Contracts/enums';
export default class DatasetTitles extends BaseSchema {
protected tableName = 'dataset_abstracts';
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary().defaultTo("nextval('dataset_abstracts_id_seq')");
table.integer('document_id').unsigned().notNullable();
table
.foreign('document_id', 'dataset_abstracts_document_id_foreign')
.references('id')
.inTable('documents')
.onDelete('CASCADE') // delete this abstract when document is deleted
.onUpdate('CASCADE');
// table.string('type', 255).notNullable();
table.enum('type', Object.values(DescriptionTypes)).notNullable();
table.string('value', 255).notNullable();
table.string('language', 3).notNullable();
});
}
public async down() {
this.schema.dropTable(this.tableName);
}
}
// -- Table: dataset_titles
// CREATE TABLE IF NOT EXISTS dataset_titles
// (
// id integer NOT NULL DEFAULT nextval('dataset_titles_id_seq'::regclass),
// document_id integer NOT NULL,
// type character varying(255) NOT NULL,
// value character varying(255) NOT NULL,
// language character varying(3) NOT NULL,
// CONSTRAINT dataset_titles_pkey PRIMARY KEY (id),
// CONSTRAINT dataset_titles_document_id_foreign FOREIGN KEY (document_id)
// REFERENCES documents (id) MATCH SIMPLE
// ON UPDATE CASCADE
// ON DELETE CASCADE,
// CONSTRAINT dataset_titles_type_check CHECK (type::text = ANY (ARRAY['Main'::character varying::text, 'Sub'::character varying::text, 'Alternative'::character varying::text, 'Translated'::character varying::text, 'Other'::character varying::text]))
// )