-
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.
Merge pull request #1665 from serlo/feat/table-for-lti-integration
feat(db-migrations): create migration for new lti integration table
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
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,26 @@ | ||
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 NOT NULL, | ||
id_token_on_creation TEXT NOT NULL, | ||
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() | ||
} |