Skip to content

Commit

Permalink
Merge pull request #1665 from serlo/feat/table-for-lti-integration
Browse files Browse the repository at this point in the history
feat(db-migrations): create migration for new lti integration table
  • Loading branch information
hugotiburtino authored Jul 11, 2024
2 parents 460918a + 1313103 commit bb26e43
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/db-migrations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@serlo/db-migrations",
"version": "1.2.0-staging.0",
"version": "1.2.0-staging.1",
"private": true,
"license": "Apache-2.0",
"type": "module",
Expand Down
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()
}

0 comments on commit bb26e43

Please sign in to comment.