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
2023-03-16 13:34:23 +08:00
..
1.0.0_beta.10-1-logto-config.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.10-1663923211-machine-to-machine-app.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.10-1664265197-custom-phrases.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.11-1664347703-rename-language-key-to-tag.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.11-1664356000-add-created-at-column-to-users.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.11-1664462389-correct-user-created-at-column-by-user-logs.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.14-1665300135-sign-in-sign-up.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.14-1667283640-remove-forgot-password.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.14-1667292082-remove-sign-in-method.ts feat(cli): rollback command for alteration (#2975) 2023-01-18 05:12:57 +00:00
1.0.0_beta.14-1667374974-user-suspend.ts refactor(schemas): fix type path 2022-12-20 13:33:53 +08:00
1.0.0_beta.14-1667900481-add-passcode-type-continue.ts feat(cli): rollback command for alteration (#2975) 2023-01-18 05:12:57 +00:00
1.0.0_beta.18-1668666590-support-multiple-connector-instances.ts release: version core packages 2023-01-06 16:48:18 +08:00
1.0.0_beta.18-1668666600-remove-connector-enabled.ts release: version core packages 2023-01-06 16:48:18 +08:00
1.0.0_beta.18-1669091623-roles-and-scopes.ts feat(cli): rollback command for alteration (#2975) 2023-01-18 05:12:57 +00:00
1.0.0_beta.18-1669702299-sign-up.ts release: version core packages 2023-01-06 16:48:18 +08:00
1.0.0_beta.18-1671039448-add-user-name-index.ts release: version core packages 2023-01-06 16:48:18 +08:00
1.0.0_beta.18-1671080370-terms-of-use.ts feat(cli): rollback command for alteration (#2975) 2023-01-18 05:12:57 +00:00
1.0.0_beta.18-1671336831-refactor-log-types.ts release: version core packages 2023-01-06 16:48:18 +08:00
1.0.0_beta.18-1671509870-hooks.ts release: version core packages 2023-01-06 16:48:18 +08:00
1.0.0_beta.18-1672119200-align-passcode-type-with-message-type.ts release: version core packages 2023-01-06 16:48:18 +08:00
1.0.0_rc.0-1672815959-user-roles.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1672820345-scope-resource-id.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1672901841-roles-and-scopes-not-null.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673001922-support-generic-passcode.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673165463-scope-name-index.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673349501-sms-sign-in-identifier-to-phone.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673465463-ac-scope-name.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673853579-ac-default-scope.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673863835-ac-scope-role.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673882867-fix-alteration-issues.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673940577-scope-description-not-null.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1673941897-application-roles.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1674032095.1-dedup-resources-constraint.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1674032095.2-oidc-model-pkey.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1674032095.3-tenant-table.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1674032095.4-add-id-column.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1674032095.5-multi-tenancy.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1674032095.6-add-tenant-id-trigger.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1674987042-drop-settings-and-create-systems.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.0-1675316731-update-seed-data.ts release: version packages 2023-02-02 22:21:34 +08:00
1.0.0_rc.1-1675788753-multi-tenancy-rls.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1676115897-add-admin-tenant.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1676185899-fix-logs-index.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1676190092-migrate-admin-data.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1676823841-update-sie-primary-key.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1676874936-support-custom-css.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1676886855-connector-database-read-write.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1676906977-remove-demo-app.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1676956206-move-console-sie-to-database.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
1.0.0_rc.1-1677059985-move-console-application-to-database.ts release: version core packages (#3225) 2023-02-25 23:15:42 +08:00
next-1677208902-update-admin-console-config.ts refactor(console): get-started tasks (#3208) 2023-02-27 10:15:55 +08:00
next-1677765137-seed-for-admin-tenant.ts refactor: seed data for multi-tenancy 2 2023-03-03 14:11:19 +08:00
next-1677907982-allow-admin-create-multiple-tenants.ts refactor: allow admin to create tenants 2023-03-04 14:52:02 +08:00
next-1678157950-privacy-policy-url.ts feat(core,console,schemas,phrases): add privacy policy url (#3315) 2023-03-08 10:56:26 +08:00
next-1678199795-add-verification-status-table.ts fix(core,schemas): remove sessionId usage from verification status table (#3345) 2023-03-13 11:20:52 +08:00
next-1678259693-remove-branding-style-config.ts refactor: remove branding style config (#3326) 2023-03-09 11:23:06 +08:00
next-1678269972-use-restrictive-policies.ts refactor(schemas): use restrictive policies 2023-03-08 19:16:42 +08:00
next-1678284778-restrict-internal-roles.ts refactor: hide internal roles for user tenants 2023-03-09 00:07:33 +08:00
next-1678425761-m2m-app-for-tenants.ts feat(cli,cloud,schemas): seed m2m app for each tenant (#3364) 2023-03-12 09:34:15 +08:00
next-1678450233-support-custom-content.ts feat(schemas,ui): add custom content slot (#3369) 2023-03-14 03:06:01 +00:00
next-1678716747-service-logs.ts feat(schemas): add service logs table (#3390) 2023-03-14 15:15:45 +08:00
next-1678928481-remove-deprecated-logto-config-item.ts refactor(console): refactor theme-related types (#3419) 2023-03-16 13:34:23 +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";
  `);
};