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

55 lines
2.4 KiB
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema';
export default class LinkDocumentsCollections extends BaseSchema {
protected tableName = 'link_documents_collections';
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.integer('collection_id').index('link_documents_collections_collection_id_index').notNullable();
table
.foreign('collection_id', 'link_documents_collections_collection_id_foreign')
.references('id')
.inTable('collections')
.onDelete('CASCADE') // don't delete this when collection is deleted
.onUpdate('CASCADE');
table.integer('document_id').index('link_documents_collections_document_id_index').notNullable();
table
.foreign('document_id', 'link_documents_collections_document_id_foreign')
.references('id')
.inTable('documents')
.onDelete('CASCADE') // don't delete this when document is deleted
.onUpdate('CASCADE');
table.primary(['collection_id', 'document_id']);
});
}
public async down() {
this.schema.dropTable(this.tableName);
}
}
// -- Table: link_documents_collections
// CREATE TABLE IF NOT EXISTS link_documents_collections
// (
// collection_id integer NOT NULL,
// document_id integer NOT NULL,
// CONSTRAINT link_documents_collections_pkey PRIMARY KEY (collection_id, document_id),
// CONSTRAINT link_documents_collections_collection_id_foreign FOREIGN KEY (collection_id)
// REFERENCES collections (id) MATCH SIMPLE
// ON UPDATE CASCADE
// ON DELETE CASCADE,
// CONSTRAINT link_documents_collections_document_id_foreign FOREIGN KEY (document_id)
// REFERENCES documents (id) MATCH SIMPLE
// ON UPDATE CASCADE
// ON DELETE CASCADE
// )
// -- Index: link_documents_collections_collection_id_index
// -- DROP INDEX IF EXISTS link_documents_collections_collection_id_index;
// CREATE INDEX IF NOT EXISTS link_documents_collections_collection_id_index
// ON link_documents_collections USING btree (collection_id ASC);
// -- Index: link_documents_collections_document_id_index
// -- DROP INDEX IF EXISTS link_documents_collections_document_id_index;
// CREATE INDEX IF NOT EXISTS link_documents_collections_document_id_index
// ON link_documents_collections USING btree (document_id ASC);