| 8 | // Datasource "my_db": MongoDB database "tests-migrate" at "localhost:27017" |
| 9 | // Datasource "my_db": SQL Server database |
| 10 | export function printDatasource({ datasourceInfo }: { datasourceInfo: DatasourceInfo }): void { |
| 11 | if (!datasourceInfo.name || !datasourceInfo.prettyProvider) return |
| 12 | |
| 13 | let message = `Datasource "${datasourceInfo.name}": ${datasourceInfo.prettyProvider} database` |
| 14 | if (datasourceInfo.dbName) { |
| 15 | message += ` "${datasourceInfo.dbName}"` |
| 16 | } |
| 17 | |
| 18 | // If schemas are defined in the datasource block, print them |
| 19 | if (datasourceInfo.schemas?.length) { |
| 20 | message += `, schemas "${datasourceInfo.schemas.join(', ')}"` |
| 21 | } |
| 22 | // Otherwise, print the schema if it's defined in the connection string |
| 23 | else if (datasourceInfo.schema) { |
| 24 | message += `, schema "${datasourceInfo.schema}"` |
| 25 | } |
| 26 | |
| 27 | if (datasourceInfo.dbLocation) { |
| 28 | message += ` at "${datasourceInfo.dbLocation}"` |
| 29 | } |
| 30 | |
| 31 | process.stdout.write(dim(message) + '\n') |
| 32 | } |