0
Fork 0
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:
wangsijie 2022-11-04 10:10:01 +08:00 committed by GitHub
parent 0530eafda7
commit 73bb938c3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 0 deletions

View file

@ -19,6 +19,7 @@ export const mockUser: User = {
applicationId: 'bar',
lastSignInAt: 1_650_969_465_789,
createdAt: 1_650_969_000_000,
isSuspended: false,
};
export const mockUserResponse = pick(mockUser, ...userInfoSelectFields);
@ -41,6 +42,7 @@ export const mockUserWithPassword: User = {
applicationId: 'bar',
lastSignInAt: 1_650_969_465_789,
createdAt: 1_650_969_000_000,
isSuspended: false,
};
export const mockUserList: User[] = [
@ -59,6 +61,7 @@ export const mockUserList: User[] = [
applicationId: 'bar',
lastSignInAt: 1_650_969_465_000,
createdAt: 1_650_969_000_000,
isSuspended: false,
},
{
id: '2',
@ -75,6 +78,7 @@ export const mockUserList: User[] = [
applicationId: 'bar',
lastSignInAt: 1_650_969_465_000,
createdAt: 1_650_969_000_000,
isSuspended: false,
},
{
id: '3',
@ -91,6 +95,7 @@ export const mockUserList: User[] = [
applicationId: 'bar',
lastSignInAt: 1_650_969_465_000,
createdAt: 1_650_969_000_000,
isSuspended: false,
},
{
id: '4',
@ -107,6 +112,7 @@ export const mockUserList: User[] = [
applicationId: 'bar',
lastSignInAt: 1_650_969_465_000,
createdAt: 1_650_969_000_000,
isSuspended: false,
},
{
id: '5',
@ -123,6 +129,7 @@ export const mockUserList: User[] = [
applicationId: 'bar',
lastSignInAt: 1_650_969_465_000,
createdAt: 1_650_969_000_000,
isSuspended: false,
},
];

View 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;

View file

@ -13,6 +13,7 @@ create table users (
role_names jsonb /* @use RoleNames */ not null default '[]'::jsonb,
identities jsonb /* @use Identities */ 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,
created_at timestamptz not null default (now()),
primary key (id)