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

57 lines
2.2 KiB
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema';
export default class Collections extends BaseSchema {
protected tableName = 'collections';
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').defaultTo("nextval('collections_id_seq')");
table.integer('role_id').unsigned();
table
.foreign('role_id', 'collections_role_id_foreign')
.references('id')
.inTable('collections_roles')
.onDelete('CASCADE') // delete this collection when collection_role is deleted
.onUpdate('CASCADE');
table.string('number', 255);
table.string('name', 255).notNullable();
table.string('oai_subset', 255);
table.integer('parent_id').unsigned();
table
.foreign('parent_id', 'collections_parent_id_foreign')
.references('id')
.inTable('collections')
.onDelete('CASCADE') // delete this collection when parent collection is deleted
.onUpdate('CASCADE');
table.boolean('visible').notNullable().defaultTo(true);
table.boolean('visible_publish').notNullable().defaultTo(true);
});
}
public async down() {
this.schema.dropTable(this.tableName);
}
}
// -- Table: collections
// CREATE TABLE IF NOT EXISTS collections
// (
// id integer NOT NULL DEFAULT nextval('collections_id_seq'::regclass),
// role_id integer,
// "number" character varying(255),
// name character varying(255) NOT NULL,
// oai_subset character varying(255),
// parent_id integer,
// visible boolean NOT NULL DEFAULT true,
// visible_publish boolean NOT NULL DEFAULT true,
// CONSTRAINT collections_pkey PRIMARY KEY (id),
// CONSTRAINT collections_parent_id_foreign FOREIGN KEY (parent_id)
// REFERENCES collections (id) MATCH SIMPLE
// ON UPDATE CASCADE
// ON DELETE CASCADE,
// CONSTRAINT collections_role_id_foreign FOREIGN KEY (role_id)
// REFERENCES collections_roles (id) MATCH SIMPLE
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )