-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(db-migrations): create migration for new lti integration table
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
packages/db-migrations/src/20240708161200-add-table-for-lti-integration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ApiCache, Database, SlackLogger } from './utils' | ||
|
||
export async function up(db: Database) { | ||
const apiCache = new ApiCache() | ||
const logger = new SlackLogger('20240708161200-add-table-for-lti-integration') | ||
|
||
await db.runSql(` | ||
CREATE TABLE lti_entity ( | ||
id BIGINT NOT NULL AUTO_INCREMENT, | ||
resource_link_id VARCHAR(255), | ||
custom_claim_id VARCHAR(255) NOT NULL, | ||
content LONGTEXT, | ||
PRIMARY KEY (id) | ||
) | ||
`) | ||
|
||
await db.runSql(` | ||
CREATE INDEX idx_lti_entity_custom_claim_id ON lti_entity (custom_claim_id); | ||
`) | ||
|
||
await logger.closeAndSend() | ||
// To reduce the time between deleting the keys and finishing the DB | ||
// transaction, this should be the last command | ||
await apiCache.deleteKeysAndQuit() | ||
} |