gristlabs_grist-core/app/gen-server/migration/1678737195050-ForkIndexes.ts
George Gevoian be8e13df64 (core) Add initial tutorials implementation
Summary:
Documents can now be flagged as tutorials, which causes them to display
Markdown-formatted slides from a special GristDocTutorial table. Tutorial
documents are forked on open, and remember the last slide a user was on.
They can be restarted too, which prepares a new fork of the tutorial.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3813
2023-03-22 10:09:02 -04:00

22 lines
806 B
TypeScript

import {MigrationInterface, QueryRunner, TableIndex} from "typeorm";
export class ForkIndexes1678737195050 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
// HomeDBManager._onFork() references created_by in the ON clause.
await queryRunner.createIndex("docs", new TableIndex({
name: "docs__created_by",
columnNames: ["created_by"]
}));
// HomeDBManager.getDocForks() references trunk_id in the WHERE clause.
await queryRunner.createIndex("docs", new TableIndex({
name: "docs__trunk_id",
columnNames: ["trunk_id"]
}));
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropIndex("docs", "docs__created_by");
await queryRunner.dropIndex("docs", "docs__trunk_id");
}
}