0
Fork 0
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:
Gao Sun 2023-02-24 13:47:35 +08:00 committed by GitHub
commit 77d90e8e4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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
`); `);

View file

@ -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`