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
2024-01-11 14:38:37 +08:00
..
utils feat(schemas): init org invitation tables 2024-01-11 14:38:37 +08:00
1.0.0-1677208902-update-admin-console-config.ts
1.0.0-1677765137-seed-for-admin-tenant.ts
1.0.0-1677907982-allow-admin-create-multiple-tenants.ts
1.0.0-1678157950-privacy-policy-url.ts
1.0.0-1678199795-add-verification-status-table.ts
1.0.0-1678259693-remove-branding-style-config.ts
1.0.0-1678269972-use-restrictive-policies.ts
1.0.0-1678284778-restrict-internal-roles.ts
1.0.0-1678425761-m2m-app-for-tenants.ts
1.0.0-1678450233-support-custom-content.ts
1.0.0-1678716747-service-logs.ts refactor(schemas,core,console): use JsonObject instead of ArbitraryObject (#3730) 2023-04-24 11:11:27 +08:00
1.0.0-1678928481-remove-deprecated-logto-config-item.ts
1.0.0-1678953179-update-get-started-task-config.ts
1.0.0-1679209413-drop-connector-database-storage.ts
1.0.0_beta.10-1-logto-config.ts refactor(schemas,core,console): use JsonObject instead of ArbitraryObject (#3730) 2023-04-24 11:11:27 +08:00
1.0.0_beta.10-1663923211-machine-to-machine-app.ts
1.0.0_beta.10-1664265197-custom-phrases.ts
1.0.0_beta.11-1664347703-rename-language-key-to-tag.ts
1.0.0_beta.11-1664356000-add-created-at-column-to-users.ts
1.0.0_beta.11-1664462389-correct-user-created-at-column-by-user-logs.ts
1.0.0_beta.14-1665300135-sign-in-sign-up.ts
1.0.0_beta.14-1667283640-remove-forgot-password.ts
1.0.0_beta.14-1667292082-remove-sign-in-method.ts
1.0.0_beta.14-1667374974-user-suspend.ts
1.0.0_beta.14-1667900481-add-passcode-type-continue.ts
1.0.0_beta.18-1668666590-support-multiple-connector-instances.ts
1.0.0_beta.18-1668666600-remove-connector-enabled.ts
1.0.0_beta.18-1669091623-roles-and-scopes.ts
1.0.0_beta.18-1669702299-sign-up.ts
1.0.0_beta.18-1671039448-add-user-name-index.ts
1.0.0_beta.18-1671080370-terms-of-use.ts
1.0.0_beta.18-1671336831-refactor-log-types.ts
1.0.0_beta.18-1671509870-hooks.ts
1.0.0_beta.18-1672119200-align-passcode-type-with-message-type.ts
1.0.0_rc.0-1672815959-user-roles.ts
1.0.0_rc.0-1672820345-scope-resource-id.ts
1.0.0_rc.0-1672901841-roles-and-scopes-not-null.ts
1.0.0_rc.0-1673001922-support-generic-passcode.ts
1.0.0_rc.0-1673165463-scope-name-index.ts
1.0.0_rc.0-1673349501-sms-sign-in-identifier-to-phone.ts
1.0.0_rc.0-1673465463-ac-scope-name.ts
1.0.0_rc.0-1673853579-ac-default-scope.ts
1.0.0_rc.0-1673863835-ac-scope-role.ts
1.0.0_rc.0-1673882867-fix-alteration-issues.ts
1.0.0_rc.0-1673940577-scope-description-not-null.ts
1.0.0_rc.0-1673941897-application-roles.ts
1.0.0_rc.0-1674032095.1-dedup-resources-constraint.ts
1.0.0_rc.0-1674032095.2-oidc-model-pkey.ts
1.0.0_rc.0-1674032095.3-tenant-table.ts
1.0.0_rc.0-1674032095.4-add-id-column.ts
1.0.0_rc.0-1674032095.5-multi-tenancy.ts
1.0.0_rc.0-1674032095.6-add-tenant-id-trigger.ts
1.0.0_rc.0-1674987042-drop-settings-and-create-systems.ts
1.0.0_rc.0-1675316731-update-seed-data.ts
1.0.0_rc.1-1675788753-multi-tenancy-rls.ts
1.0.0_rc.1-1676115897-add-admin-tenant.ts
1.0.0_rc.1-1676185899-fix-logs-index.ts
1.0.0_rc.1-1676190092-migrate-admin-data.ts
1.0.0_rc.1-1676823841-update-sie-primary-key.ts
1.0.0_rc.1-1676874936-support-custom-css.ts
1.0.0_rc.1-1676886855-connector-database-read-write.ts
1.0.0_rc.1-1676906977-remove-demo-app.ts
1.0.0_rc.1-1676956206-move-console-sie-to-database.ts
1.0.0_rc.1-1677059985-move-console-application-to-database.ts
1.2.0-1681267285-fix-get-started-passwordless-status.ts release: version packages (#3705) 2023-04-18 21:13:31 +08:00
1.3.0-1683292832-update-hooks.ts release: version packages (#3794) 2023-05-16 04:52:17 +00:00
1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.ts release: version packages (#3857) 2023-06-06 23:21:29 +08:00
1.5.0-1684739802-create-hook-id-index-for-logs.ts release: version packages (#3857) 2023-06-06 23:21:29 +08:00
1.5.0-1684822341-init-domains.ts release: version packages (#3857) 2023-06-06 23:21:29 +08:00
1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.ts release: version packages (#3857) 2023-06-06 23:21:29 +08:00
1.5.0-1685285719-support-default-resource.ts release: version packages (#3857) 2023-06-06 23:21:29 +08:00
1.6.0-1685691718-domain-unique.ts release: version packages (#4033) 2023-06-28 18:57:43 +08:00
1.7.0-1688375200-sync-cloud-m2m-to-logto-config.ts release: version packages (#4255) 2023-07-31 18:43:59 +08:00
1.7.0-1688613459-remove-m2m-credentials-from-existing-logto-email-connector-config.ts release: version packages (#4255) 2023-07-31 18:43:59 +08:00
1.7.0-1688627407-daily-active-users.ts release: version packages (#4255) 2023-07-31 18:43:59 +08:00
1.8.0-1692088012-add-is-suspend-column-to-tenants-table.ts release: version packages (#4270) 2023-08-30 16:16:55 +08:00
1.8.0-1692194751-add-affiliate-scopes.ts release: version packages (#4270) 2023-08-30 16:16:55 +08:00
1.9.0-1693554904-add-possword-policy.ts release: version packages (#4451) 2023-09-18 10:47:19 +00:00
1.9.0-1694399696-add-type-col-to-roles-table.ts release: version packages (#4451) 2023-09-18 10:47:19 +00:00
1.9.0-1694418765-specify-check-role-type-function-to-be-public-schema.ts release: version packages (#4451) 2023-09-18 10:47:19 +00:00
1.9.0-1694484927-remove-deprecated-challenge-flag.ts release: version packages (#4451) 2023-09-18 10:47:19 +00:00
1.9.0-1694487524-sie-mfa.ts release: version packages (#4451) 2023-09-18 10:47:19 +00:00
1.9.0-1694509714-keep-existing-password-policy.ts release: version packages (#4451) 2023-09-18 10:47:19 +00:00
1.9.0-1694746763-user-verifications.ts release: version packages (#4451) 2023-09-18 10:47:19 +00:00
1.9.2-1694854226-init-sentinel.ts release: version packages (#4575) 2023-10-07 00:39:33 -05:00
1.9.2-1695198741-remove-m2m-app-admin-access-switch.ts chore(schemas): format alteration script (#4617) 2023-10-07 06:14:58 +00:00
1.10.1-1695647183-update-private-key-type.ts release: version packages (#4624) 2023-11-03 13:14:52 +08:00
1.10.1-1696657546-organization-tables.ts release: version packages (#4624) 2023-11-03 13:14:52 +08:00
1.10.1-1697683802-add-sso-connectors-table.ts release: version packages (#4624) 2023-11-03 13:14:52 +08:00
1.10.1-1698646271-add-organization-created-flag.ts release: version packages (#4624) 2023-11-03 13:14:52 +08:00
1.10.1-1698820410-add-user-sso-identities-table.ts release: version packages (#4624) 2023-11-03 13:14:52 +08:00
1.10.1-1698910485-user-logto-data.ts release: version packages (#4624) 2023-11-03 13:14:52 +08:00
1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts release: version packages (#4873) 2023-11-14 19:57:42 +08:00
1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.ts release: version packages (#4873) 2023-11-14 19:57:42 +08:00
1.12.0-1700031616-update-org-role-foreign-keys.ts release: version packages (#4894) 2023-12-06 16:13:56 +08:00
1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.ts release: version packages (#4894) 2023-12-06 16:13:56 +08:00
1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.ts release: version packages (#4894) 2023-12-06 16:13:56 +08:00
next-1702274830-add-new-third-party-column-to-applications-table.ts feat(core,schemas): add isThirdParty column to the applications table (#5090) 2023-12-12 14:54:49 +08:00
next-1702372401-add-application-permissions-tables.ts feat(schemas): add application permissions relation tables (#5097) 2023-12-15 10:18:44 +08:00
next-1702544178-sync-tenant-orgs.ts refactor(schemas): skip adding membership when no user found 2023-12-16 14:48:01 +08:00
next-1702871078-protected-application-type.ts feat(schemas): add new application type for protected app (#5112) 2023-12-19 15:59:27 +08:00
next-1702877515-protected-app-configs.ts feat(schemas): add column protected_app_metadata (#5113) 2023-12-19 17:04:14 +08:00
next-1702978120-application-sign-in-experience-table.ts feat(schemas): add application sign-in-experience table (#5122) 2023-12-21 10:20:45 +08:00
next-1703229996-daily-token-usage.ts feat(core,schemas): add daily token usage table to ease the usage calculation (#5148) 2023-12-25 04:56:53 +00:00
next-1703230000-update-tenant-roles.ts fix(schemas): update alteration script timestamp 2023-12-26 11:54:51 +08:00
next-1704692973-remove-legacy-resources.ts refactor(schemas): fix alteration script 2024-01-09 20:20:12 +08:00
next-1704934999-add-magic-links-table.ts feat(schemas): init org invitation tables 2024-01-11 14:38:37 +08:00
next-1704935001-add-organization-invitation-tables.ts feat(schemas): init org invitation tables 2024-01-11 14:38:37 +08:00
README.md

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";
  `);
};