mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
Merge pull request #3209 from logto-io/gao-fix-alteration-script
refactor: fix alteration script
This commit is contained in:
commit
77d90e8e4e
3 changed files with 4 additions and 2 deletions
|
@ -14,7 +14,7 @@ const allAlterations = execSync("pnpm cli db alter list", {
|
||||||
.filter((filename) => Boolean(filename))
|
.filter((filename) => Boolean(filename))
|
||||||
.map((filename) => filename.replace(".js", ""));
|
.map((filename) => filename.replace(".js", ""));
|
||||||
|
|
||||||
const diffFiles = execSync("git diff --name-only HEAD HEAD~1", {
|
const diffFiles = execSync("git diff HEAD~1 HEAD --name-only --diff-filter=ACR", {
|
||||||
encoding: "utf-8",
|
encoding: "utf-8",
|
||||||
});
|
});
|
||||||
const committedAlterations = diffFiles
|
const committedAlterations = diffFiles
|
||||||
|
|
|
@ -202,6 +202,7 @@ export const createUserQueries = (pool: CommonQueryMethods) => {
|
||||||
pool.exists(sql`
|
pool.exists(sql`
|
||||||
select ${fields.id}
|
select ${fields.id}
|
||||||
from ${table}
|
from ${table}
|
||||||
|
where ${fields.isSuspended} = false
|
||||||
limit 1
|
limit 1
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,8 @@ const alteration: AlterationScript = {
|
||||||
const hasActiveUsers = await pool.exists(sql`
|
const hasActiveUsers = await pool.exists(sql`
|
||||||
select id
|
select id
|
||||||
from users
|
from users
|
||||||
where tenant_id = 'default'
|
where tenant_id = 'admin'
|
||||||
|
and is_suspended = false
|
||||||
limit 1
|
limit 1
|
||||||
`);
|
`);
|
||||||
await pool.query(sql`
|
await pool.query(sql`
|
||||||
|
|
Loading…
Reference in a new issue