0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/packages/schemas/alterations
simeng-li 559331d51e
refactor(core,schemas): make the jwt customizer script field mandatory (#5696)
* refactor(core,schemas): make the jwt customizer script field mandatory

make the jwt customizer script field mandatory

* fix(schemas): fix the alteration script

fix the alteration script

* fix(schemas): fix ut

fix ut
2024-04-15 10:38:30 +08:00
..
utils refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1677208902-update-admin-console-config.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1677765137-seed-for-admin-tenant.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1677907982-allow-admin-create-multiple-tenants.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678157950-privacy-policy-url.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678199795-add-verification-status-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678259693-remove-branding-style-config.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678269972-use-restrictive-policies.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678284778-restrict-internal-roles.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678425761-m2m-app-for-tenants.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678450233-support-custom-content.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678716747-service-logs.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678928481-remove-deprecated-logto-config-item.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1678953179-update-get-started-task-config.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0-1679209413-drop-connector-database-storage.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.10-1-logto-config.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.10-1663923211-machine-to-machine-app.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.10-1664265197-custom-phrases.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.11-1664347703-rename-language-key-to-tag.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.11-1664356000-add-created-at-column-to-users.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.11-1664462389-correct-user-created-at-column-by-user-logs.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.14-1665300135-sign-in-sign-up.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.14-1667283640-remove-forgot-password.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.14-1667292082-remove-sign-in-method.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.14-1667374974-user-suspend.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.14-1667900481-add-passcode-type-continue.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1668666590-support-multiple-connector-instances.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1668666600-remove-connector-enabled.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1669091623-roles-and-scopes.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1669702299-sign-up.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1671039448-add-user-name-index.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1671080370-terms-of-use.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1671336831-refactor-log-types.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1671509870-hooks.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_beta.18-1672119200-align-passcode-type-with-message-type.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1672815959-user-roles.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1672820345-scope-resource-id.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1672901841-roles-and-scopes-not-null.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673001922-support-generic-passcode.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673165463-scope-name-index.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673349501-sms-sign-in-identifier-to-phone.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673465463-ac-scope-name.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673853579-ac-default-scope.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673863835-ac-scope-role.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673882867-fix-alteration-issues.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673940577-scope-description-not-null.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1673941897-application-roles.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1674032095.1-dedup-resources-constraint.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1674032095.2-oidc-model-pkey.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1674032095.3-tenant-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1674032095.4-add-id-column.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1674032095.5-multi-tenancy.ts chore: upgrade slonik 2024-03-18 09:59:38 +08:00
1.0.0_rc.0-1674032095.6-add-tenant-id-trigger.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1674987042-drop-settings-and-create-systems.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.0-1675316731-update-seed-data.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.1-1675788753-multi-tenancy-rls.ts chore: upgrade slonik 2024-03-18 09:59:38 +08:00
1.0.0_rc.1-1676115897-add-admin-tenant.ts chore: upgrade slonik 2024-03-18 09:59:38 +08:00
1.0.0_rc.1-1676185899-fix-logs-index.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.1-1676190092-migrate-admin-data.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.1-1676823841-update-sie-primary-key.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.1-1676874936-support-custom-css.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.1-1676886855-connector-database-read-write.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.1-1676906977-remove-demo-app.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.1-1676956206-move-console-sie-to-database.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.0.0_rc.1-1677059985-move-console-application-to-database.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.2.0-1681267285-fix-get-started-passwordless-status.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.3.0-1683292832-update-hooks.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.5.0-1684739802-create-hook-id-index-for-logs.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.5.0-1684822341-init-domains.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.5.0-1685285719-support-default-resource.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.6.0-1685691718-domain-unique.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.7.0-1688375200-sync-cloud-m2m-to-logto-config.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.7.0-1688613459-remove-m2m-credentials-from-existing-logto-email-connector-config.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.7.0-1688627407-daily-active-users.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.8.0-1692088012-add-is-suspend-column-to-tenants-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.8.0-1692194751-add-affiliate-scopes.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.0-1693554904-add-possword-policy.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.0-1694399696-add-type-col-to-roles-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.0-1694418765-specify-check-role-type-function-to-be-public-schema.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.0-1694484927-remove-deprecated-challenge-flag.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.0-1694487524-sie-mfa.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.0-1694509714-keep-existing-password-policy.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.0-1694746763-user-verifications.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.2-1694854226-init-sentinel.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.9.2-1695198741-remove-m2m-app-admin-access-switch.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.10.1-1695647183-update-private-key-type.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.10.1-1696657546-organization-tables.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.10.1-1697683802-add-sso-connectors-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.10.1-1698646271-add-organization-created-flag.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.10.1-1698820410-add-user-sso-identities-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.10.1-1698910485-user-logto-data.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.12.0-1700031616-update-org-role-foreign-keys.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1702274830-add-new-third-party-column-to-applications-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1702372401-add-application-permissions-tables.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1702544178-sync-tenant-orgs.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1702871078-protected-application-type.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1702877515-protected-app-configs.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1702978120-application-sign-in-experience-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1703229996-daily-token-usage.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1703230000-update-tenant-roles.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1704692973-remove-legacy-resources.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1704934999-add-magic-links-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1704935001-add-organization-invitation-tables.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1705288654-add-application-user-consent-organizations-table.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1705991158-update-invitation-indices.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1706449174-update-organization-invitation-column.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1706510290-protected-app-host-index.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1706512952-restore-get-started-page.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1706528755-remove-magic-links.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.0-1706585206-protected-app-custom-domain-unique.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.13.1-1707360939-grant-is-suspended-read-permission.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.14.0-1708916601-remove-management-api-scopes-assigned-to-user-role.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.14.0-1709190131-enhance-dau-data-accuracy.ts refactor: use silverhand slonik 2024-03-16 19:04:55 +08:00
1.15.0-1709521416-user-password-encrypt-method.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1709528944-regenerate-dau-data.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1710223946-add-fetch-custom-jwt-cloud-scope.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1710408335-make-resource-scopes-description-nullable.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1710859622-add-oidc-standard-claim-properties.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1711607772-remove-invite-member-scope-from-tenant-member-role.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1711624564-add-read-member-scope-to-tenant-roles.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1711955211-organization-resource-scope.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1712041436-rename-organization-member-role-to-collaborator.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1712545011-fix-organization-resource-scope.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
1.15.0-1712559358-fix-down-organization-resource-scope.ts release: version packages (#5463) 2024-04-10 21:27:24 +08:00
next-1712912361-delete-jwt-customier-with-empty-script.ts refactor(core,schemas): make the jwt customizer script field mandatory (#5696) 2024-04-15 10:38:30 +08:00
README.md chore: update contributing (#2209) 2022-10-19 14:47:59 +00:00

Database alteration

The folder for all alteration files.

Format

The alteration files are named in the format of <version>-<timestamp>-name.js where <timestamp> is the unix timestamp of when the alteration was created and name is the name of the alteration, version is this npm package's version number.

As for development, the version is "next" until the package is released.

Note that, you SHOULD NOT change the content of the alteration files after they are created. If you need to change the alteration, you should create a new alteration file with the new content.

Deploy unreleased alterations

To deploy scripts with the next version, run pnpm alteration deploy next. This is helpful if you want to test your alteration scripts.

Typing

type AlterationScript = {
  up: (connection: DatabaseTransactionConnection) => Promise<void>;
  down: (connection: DatabaseTransactionConnection) => Promise<void>;
};

When the alteration script is executed, the up function is called to alter the database schema.

The down function is designed for the future downgrade feature.

Example

export const up = async (connection) => {
  await connection.query(`
    alter table "user"
    add column "email" varchar(255) not null;
  `);
};

export const down = async (connection) => {
  await connection.query(`
    alter table "user"
    drop column "email";
  `);
};