1 | const color = require('colorette');
|
2 |
|
3 | const { success } = require('./cli-config-utils');
|
4 |
|
5 | function listMigrations(completed, newMigrations) {
|
6 | let message = '';
|
7 |
|
8 | if (completed.length === 0) {
|
9 | message += color.red('No Completed Migration files Found. \n');
|
10 | } else {
|
11 | message = color.green(
|
12 | `Found ${completed.length} Completed Migration file/files.\n`
|
13 | );
|
14 |
|
15 | for (let i = 0; i < completed.length; i++) {
|
16 | const file = completed[i];
|
17 | message += color.cyan(`${file} \n`);
|
18 | }
|
19 | }
|
20 |
|
21 | if (newMigrations.length === 0) {
|
22 | message += color.red('No Pending Migration files Found.\n');
|
23 | } else {
|
24 | message += color.green(
|
25 | `Found ${newMigrations.length} Pending Migration file/files.\n`
|
26 | );
|
27 |
|
28 | for (let i = 0; i < newMigrations.length; i++) {
|
29 | const file = newMigrations[i];
|
30 | message += color.cyan(`${file.file} \n`);
|
31 | }
|
32 | }
|
33 |
|
34 | success(message);
|
35 | }
|
36 |
|
37 | module.exports = { listMigrations };
|