mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
feat(schemas): add user is suspended column (#2305)
Co-authored-by: Gao Sun <gao@silverhand.io>
This commit is contained in:
parent
0530eafda7
commit
73bb938c3c
3 changed files with 26 additions and 0 deletions
|
@ -19,6 +19,7 @@ export const mockUser: User = {
|
||||||
applicationId: 'bar',
|
applicationId: 'bar',
|
||||||
lastSignInAt: 1_650_969_465_789,
|
lastSignInAt: 1_650_969_465_789,
|
||||||
createdAt: 1_650_969_000_000,
|
createdAt: 1_650_969_000_000,
|
||||||
|
isSuspended: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mockUserResponse = pick(mockUser, ...userInfoSelectFields);
|
export const mockUserResponse = pick(mockUser, ...userInfoSelectFields);
|
||||||
|
@ -41,6 +42,7 @@ export const mockUserWithPassword: User = {
|
||||||
applicationId: 'bar',
|
applicationId: 'bar',
|
||||||
lastSignInAt: 1_650_969_465_789,
|
lastSignInAt: 1_650_969_465_789,
|
||||||
createdAt: 1_650_969_000_000,
|
createdAt: 1_650_969_000_000,
|
||||||
|
isSuspended: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mockUserList: User[] = [
|
export const mockUserList: User[] = [
|
||||||
|
@ -59,6 +61,7 @@ export const mockUserList: User[] = [
|
||||||
applicationId: 'bar',
|
applicationId: 'bar',
|
||||||
lastSignInAt: 1_650_969_465_000,
|
lastSignInAt: 1_650_969_465_000,
|
||||||
createdAt: 1_650_969_000_000,
|
createdAt: 1_650_969_000_000,
|
||||||
|
isSuspended: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '2',
|
id: '2',
|
||||||
|
@ -75,6 +78,7 @@ export const mockUserList: User[] = [
|
||||||
applicationId: 'bar',
|
applicationId: 'bar',
|
||||||
lastSignInAt: 1_650_969_465_000,
|
lastSignInAt: 1_650_969_465_000,
|
||||||
createdAt: 1_650_969_000_000,
|
createdAt: 1_650_969_000_000,
|
||||||
|
isSuspended: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '3',
|
id: '3',
|
||||||
|
@ -91,6 +95,7 @@ export const mockUserList: User[] = [
|
||||||
applicationId: 'bar',
|
applicationId: 'bar',
|
||||||
lastSignInAt: 1_650_969_465_000,
|
lastSignInAt: 1_650_969_465_000,
|
||||||
createdAt: 1_650_969_000_000,
|
createdAt: 1_650_969_000_000,
|
||||||
|
isSuspended: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '4',
|
id: '4',
|
||||||
|
@ -107,6 +112,7 @@ export const mockUserList: User[] = [
|
||||||
applicationId: 'bar',
|
applicationId: 'bar',
|
||||||
lastSignInAt: 1_650_969_465_000,
|
lastSignInAt: 1_650_969_465_000,
|
||||||
createdAt: 1_650_969_000_000,
|
createdAt: 1_650_969_000_000,
|
||||||
|
isSuspended: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '5',
|
id: '5',
|
||||||
|
@ -123,6 +129,7 @@ export const mockUserList: User[] = [
|
||||||
applicationId: 'bar',
|
applicationId: 'bar',
|
||||||
lastSignInAt: 1_650_969_465_000,
|
lastSignInAt: 1_650_969_465_000,
|
||||||
createdAt: 1_650_969_000_000,
|
createdAt: 1_650_969_000_000,
|
||||||
|
isSuspended: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
18
packages/schemas/alterations/next-1667374974-user-suspend.ts
Normal file
18
packages/schemas/alterations/next-1667374974-user-suspend.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { sql } from 'slonik';
|
||||||
|
|
||||||
|
import type { AlterationScript } from '../lib/types/alteration';
|
||||||
|
|
||||||
|
const alteration: AlterationScript = {
|
||||||
|
up: async (pool) => {
|
||||||
|
await pool.query(sql`
|
||||||
|
alter table users add column is_suspended boolean not null default false;
|
||||||
|
`);
|
||||||
|
},
|
||||||
|
down: async (pool) => {
|
||||||
|
await pool.query(sql`
|
||||||
|
alter table users drop column is_suspended;
|
||||||
|
`);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default alteration;
|
|
@ -13,6 +13,7 @@ create table users (
|
||||||
role_names jsonb /* @use RoleNames */ not null default '[]'::jsonb,
|
role_names jsonb /* @use RoleNames */ not null default '[]'::jsonb,
|
||||||
identities jsonb /* @use Identities */ not null default '{}'::jsonb,
|
identities jsonb /* @use Identities */ not null default '{}'::jsonb,
|
||||||
custom_data jsonb /* @use ArbitraryObject */ not null default '{}'::jsonb,
|
custom_data jsonb /* @use ArbitraryObject */ not null default '{}'::jsonb,
|
||||||
|
is_suspended boolean not null default false,
|
||||||
last_sign_in_at timestamptz,
|
last_sign_in_at timestamptz,
|
||||||
created_at timestamptz not null default (now()),
|
created_at timestamptz not null default (now()),
|
||||||
primary key (id)
|
primary key (id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue