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

53 lines
2.0 KiB
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema';
import { PersonNameTypes } from 'Contracts/enums';
export default class Persons extends BaseSchema {
protected tableName = 'persons';
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary().defaultTo("nextval('persons_id_seq')");
table.string('academic_title', 255);
table.string('date_of_birth', 100);
table.string('email', 100).notNullable();
table.string('first_name', 255);
table.string('last_name', 255);
table.string('place_of_birth', 255);
table.string('identifier_orcid', 50);
table.string('identifier_gnd', 50);
table.string('identifier_misc', 50);
table.boolean('status').defaultTo(true);
table.integer('registered_at');
// table.string('name_type', 255);
table.enum('name_type', Object.values(PersonNameTypes)).notNullable();
table.timestamp('created_at', { useTz: false }).nullable();
});
}
public async down() {
this.schema.dropTable(this.tableName);
}
}
// -- Table: persons
// CREATE TABLE IF NOT EXISTS persons
// (
// id integer NOT NULL DEFAULT nextval('persons_id_seq'::regclass),
// academic_title character varying(255),
// date_of_birth character varying(100),
// email character varying(100) NOT NULL,
// first_name character varying(255),
// last_name character varying(255),
// place_of_birth character varying(255),
// identifier_orcid character varying(50),
// identifier_gnd character varying(50),
// identifier_misc character varying(50),
// status boolean DEFAULT true,
// registered_at integer,
// name_type character varying(255),
// CONSTRAINT persons_pkey PRIMARY KEY (id),
// CONSTRAINT persons_name_type_check CHECK (name_type::text = ANY (ARRAY['Organizational'::character varying::text, 'Personal'::character varying::text]))
// )