@yunsoft/yuncms 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yunsoft/yuncms",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Command-line setup and runtime launcher for YunCMS.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "test": "node --test"
31
31
  },
32
32
  "dependencies": {
33
- "@yunsoft/yuncms-api": "0.1.5",
34
- "@yunsoft/yuncms-core": "0.1.5"
33
+ "@yunsoft/yuncms-api": "0.1.7",
34
+ "@yunsoft/yuncms-core": "0.1.7"
35
35
  }
36
36
  }
@@ -15,18 +15,18 @@ export async function resetDatabaseObjects({
15
15
  const connection = await pool.getConnection();
16
16
  try {
17
17
  const [rows] = await connection.query(
18
- `SELECT table_name, table_type
18
+ `SELECT TABLE_NAME AS object_name, TABLE_TYPE AS object_type
19
19
  FROM information_schema.tables
20
- WHERE table_schema = ?
21
- ORDER BY CASE WHEN table_type = 'VIEW' THEN 0 ELSE 1 END, table_name ASC`,
20
+ WHERE TABLE_SCHEMA = ?
21
+ ORDER BY CASE WHEN TABLE_TYPE = 'VIEW' THEN 0 ELSE 1 END, TABLE_NAME ASC`,
22
22
  [config.database],
23
23
  );
24
24
 
25
25
  await connection.query('SET FOREIGN_KEY_CHECKS = 0');
26
26
  try {
27
27
  for (const row of rows) {
28
- const name = quoteIdentifier(row.table_name, 'database object name');
29
- if (row.table_type === 'VIEW') {
28
+ const name = quoteIdentifier(row.object_name, 'database object name');
29
+ if (row.object_type === 'VIEW') {
30
30
  await connection.query(`DROP VIEW IF EXISTS ${name}`);
31
31
  } else {
32
32
  await connection.query(`DROP TABLE IF EXISTS ${name}`);
@@ -60,7 +60,7 @@ export async function runRestoreCommand({
60
60
  await maintenanceLock.assertHeld();
61
61
  };
62
62
 
63
- return await restoreBackup({
63
+ const restored = await restoreBackup({
64
64
  backupPath: resolve(cwd, positionals[0]),
65
65
  cwd,
66
66
  env,
@@ -68,6 +68,12 @@ export async function runRestoreCommand({
68
68
  allowDifferentDatabaseTarget: values['--allow-different-database-target'] === true,
69
69
  beforeDestructive,
70
70
  });
71
+ if (restored?.manifest?.project?.packageLock) {
72
+ output.warn?.('Project package files were restored. Run npm ci before starting YunCMS so node_modules matches the restored lockfile.');
73
+ } else if (restored?.manifest?.project?.packageJson) {
74
+ output.warn?.('Project package.json was restored. Run npm install before starting YunCMS so node_modules matches the restored project.');
75
+ }
76
+ return restored;
71
77
  } finally {
72
78
  if (maintenanceLock) await maintenanceLock.release();
73
79
  await lock.release();