• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

typeorm / typeorm / 19549987525

20 Nov 2025 08:11PM UTC coverage: 80.769% (+4.3%) from 76.433%
19549987525

push

github

web-flow
ci: run tests on commits to master and next (#11783)

Co-authored-by: Oleg "OSA413" Sokolov <OSA413@users.noreply.github.com>

26500 of 32174 branches covered (82.36%)

Branch coverage included in aggregate %.

91252 of 113615 relevant lines covered (80.32%)

88980.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.51
/src/commands/SchemaLogCommand.ts
1
import ansi from "ansis"
26✔
2
import path from "path"
26✔
3
import process from "process"
26✔
4
import yargs from "yargs"
26✔
5
import { DataSource } from "../data-source/DataSource"
26✔
6
import { PlatformTools } from "../platform/PlatformTools"
26✔
7
import { CommandUtils } from "./CommandUtils"
26✔
8

26✔
9
/**
26✔
10
 * Shows sql to be executed by schema:sync command.
26✔
11
 */
26✔
12
export class SchemaLogCommand implements yargs.CommandModule {
208✔
13
    command = "schema:log"
208✔
14
    describe =
208✔
15
        "Shows sql to be executed by schema:sync command. It shows sql log only for your default dataSource. " +
208✔
16
        "To run update queries on a concrete connection use -c option."
208✔
17

208✔
18
    builder(args: yargs.Argv) {
208✔
19
        return args.option("dataSource", {
×
20
            alias: "d",
×
21
            describe:
×
22
                "Path to the file where your DataSource instance is defined.",
×
23
            demandOption: true,
×
24
        })
×
25
    }
×
26

208✔
27
    async handler(args: yargs.Arguments) {
208✔
28
        let dataSource: DataSource | undefined = undefined
×
29
        try {
×
30
            dataSource = await CommandUtils.loadDataSource(
×
31
                path.resolve(process.cwd(), args.dataSource as string),
×
32
            )
×
33
            dataSource.setOptions({
×
34
                synchronize: false,
×
35
                migrationsRun: false,
×
36
                dropSchema: false,
×
37
                logging: false,
×
38
            })
×
39
            await dataSource.initialize()
×
40

×
41
            const sqlInMemory = await dataSource.driver
×
42
                .createSchemaBuilder()
×
43
                .log()
×
44

×
45
            if (sqlInMemory.upQueries.length === 0) {
×
46
                console.log(
×
47
                    ansi.yellow`Your schema is up to date - there are no queries to be executed by schema synchronization.`,
×
48
                )
×
49
            } else {
×
50
                const lineSeparator = "".padStart(
×
51
                    63 + String(sqlInMemory.upQueries.length).length,
×
52
                    "-",
×
53
                )
×
54
                console.log(ansi.yellow(lineSeparator))
×
55
                console.log(
×
56
                    ansi.yellow
×
57
                        .bold`-- Schema synchronization will execute following sql queries (${ansi.white(
×
58
                        sqlInMemory.upQueries.length.toString(),
×
59
                    )}):`,
×
60
                )
×
61
                console.log(ansi.yellow(lineSeparator))
×
62

×
63
                sqlInMemory.upQueries.forEach((upQuery) => {
×
64
                    let sqlString = upQuery.query
×
65
                    sqlString = sqlString.trim()
×
66
                    sqlString = sqlString.endsWith(";")
×
67
                        ? sqlString
×
68
                        : sqlString + ";"
×
69
                    console.log(PlatformTools.highlightSql(sqlString))
×
70
                })
×
71
            }
×
72
            await dataSource.destroy()
×
73
        } catch (err) {
×
74
            if (dataSource)
×
75
                PlatformTools.logCmdErr(
×
76
                    "Error during schema synchronization:",
×
77
                    err,
×
78
                )
×
79
            process.exit(1)
×
80
        }
×
81
    }
×
82
}
208✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc