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 54fd29e41f
feat(schemas): create sso_connectors table (#4694)
* feat(schemas): create sso_connectors table

create sso_connectors table

* chore(schemas): add comments

add comments

* fix(schemas): remove dummy comments

remove dummy comments

* fix(schemas): fix schema typo

fix schema typo

* fix(schemas): adjust the alteration column order

adjust the alteration column order

* fix(schemas): drop policy

drop policy

* chore: fix the db alteration compare job tag version

fix the db alteration compare job tag version

* fix(schemas): set sso table order

set sso table order

* fix(schemas): fix alteration script

fix alteration script
2023-10-20 10:46:09 +08:00
..
1.0.0-1677208902-update-admin-console-config.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
1.0.0-1677765137-seed-for-admin-tenant.ts refactor: reorg packages 2023-04-04 16:28:48 +08:00
1.0.0-1677907982-allow-admin-create-multiple-tenants.ts refactor: reorg packages 2023-04-04 16:28:48 +08:00
1.0.0-1678157950-privacy-policy-url.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
1.0.0-1678199795-add-verification-status-table.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
1.0.0-1678259693-remove-branding-style-config.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
1.0.0-1678269972-use-restrictive-policies.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
1.0.0-1678284778-restrict-internal-roles.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
1.0.0-1678425761-m2m-app-for-tenants.ts refactor: reorg packages 2023-04-04 16:28:48 +08:00
1.0.0-1678450233-support-custom-content.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
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 release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
1.0.0-1678953179-update-get-started-task-config.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
1.0.0-1679209413-drop-connector-database-storage.ts release: core v1.0.0 (#3554) 2023-03-20 23:57:04 +08:00
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 refactor: reorg packages 2023-04-04 16:28:48 +08:00
1.0.0_rc.1-1676115897-add-admin-tenant.ts refactor: reorg packages 2023-04-04 16:28:48 +08:00
1.0.0_rc.1-1676185899-fix-logs-index.ts
1.0.0_rc.1-1676190092-migrate-admin-data.ts refactor: reorg packages 2023-04-04 16:28:48 +08:00
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 refactor: reorg packages 2023-04-04 16:28:48 +08:00
1.0.0_rc.1-1676956206-move-console-sie-to-database.ts
1.0.0_rc.1-1677059985-move-console-application-to-database.ts refactor: reorg packages 2023-04-04 16:28:48 +08:00
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
next-1695647183-update-private-key-type.ts refactor(schemas,core,cli): alter signing key type to json object (#4582) 2023-10-08 12:51:04 -05:00
next-1696657546-organization-tables.ts refactor(schemas): make description nullable 2023-10-08 13:47:22 +08:00
next-1697683802-add-sso-connectors-table.ts feat(schemas): create sso_connectors table (#4694) 2023-10-20 10:46:09 +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";
  `);
};