0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

feat(schemas): custom ui assets db update (#6010)

This commit is contained in:
Charles Zhao 2024-07-03 14:27:03 +08:00 committed by GitHub
parent d60f6ce48e
commit 17921b5138
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 24 additions and 1 deletions

View file

@ -92,6 +92,7 @@ export const mockSignInExperience: SignInExperience = {
customCss: null,
customContent: {},
agreeToTermsPolicy: AgreeToTermsPolicy.Automatic,
customUiAssetId: null,
passwordPolicy: {},
mfa: {
policy: MfaPolicy.UserControlled,

View file

@ -40,7 +40,7 @@ describe('sign-in-experience query', () => {
it('findDefaultSignInExperience', async () => {
/* eslint-disable sql/no-unsafe-query */
const expectSql = `
select "tenant_id", "id", "color", "branding", "language_info", "terms_of_use_url", "privacy_policy_url", "agree_to_terms_policy", "sign_in", "sign_up", "social_sign_in", "social_sign_in_connector_targets", "sign_in_mode", "custom_css", "custom_content", "password_policy", "mfa", "single_sign_on_enabled"
select "tenant_id", "id", "color", "branding", "language_info", "terms_of_use_url", "privacy_policy_url", "agree_to_terms_policy", "sign_in", "sign_up", "social_sign_in", "social_sign_in_connector_targets", "sign_in_mode", "custom_css", "custom_content", "custom_ui_asset_id", "password_policy", "mfa", "single_sign_on_enabled"
from "sign_in_experiences"
where "id"=$1
`;

View file

@ -106,6 +106,7 @@ export const mockSignInExperience: SignInExperience = {
customCss: null,
customContent: {},
agreeToTermsPolicy: AgreeToTermsPolicy.ManualRegistrationOnly,
customUiAssetId: null,
passwordPolicy: {},
mfa: {
policy: MfaPolicy.UserControlled,
@ -139,6 +140,7 @@ export const mockSignInExperienceSettings: SignInExperienceResponse = {
customCss: null,
customContent: {},
agreeToTermsPolicy: mockSignInExperience.agreeToTermsPolicy,
customUiAssetId: null,
passwordPolicy: {},
mfa: {
policy: MfaPolicy.UserControlled,

View file

@ -0,0 +1,18 @@
import { sql } from '@silverhand/slonik';
import type { AlterationScript } from '../lib/types/alteration.js';
const alteration: AlterationScript = {
up: async (pool) => {
await pool.query(sql`
alter table sign_in_experiences add column custom_ui_asset_id varchar(21);
`);
},
down: async (pool) => {
await pool.query(sql`
alter table sign_in_experiences drop column custom_ui_asset_id;
`);
},
};
export default alteration;

View file

@ -49,6 +49,7 @@ export const createDefaultSignInExperience = (
signInMode: SignInMode.SignInAndRegister,
customCss: null,
customContent: {},
customUiAssetId: null,
passwordPolicy: {},
mfa: {
factors: [],

View file

@ -19,6 +19,7 @@ create table sign_in_experiences (
sign_in_mode sign_in_mode not null default 'SignInAndRegister',
custom_css text,
custom_content jsonb /* @use CustomContent */ not null default '{}'::jsonb,
custom_ui_asset_id varchar(21),
password_policy jsonb /* @use PartialPasswordPolicy */ not null default '{}'::jsonb,
mfa jsonb /* @use Mfa */ not null default '{}'::jsonb,
single_sign_on_enabled boolean not null default false,