@yunsoft/yuncms 0.1.5 → 0.1.6
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 +3 -3
- package/src/database-reset.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yunsoft/yuncms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
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.
|
|
34
|
-
"@yunsoft/yuncms-core": "0.1.
|
|
33
|
+
"@yunsoft/yuncms-api": "0.1.6",
|
|
34
|
+
"@yunsoft/yuncms-core": "0.1.6"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/src/database-reset.js
CHANGED
|
@@ -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
|
|
18
|
+
`SELECT TABLE_NAME AS object_name, TABLE_TYPE AS object_type
|
|
19
19
|
FROM information_schema.tables
|
|
20
|
-
WHERE
|
|
21
|
-
ORDER BY CASE WHEN
|
|
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.
|
|
29
|
-
if (row.
|
|
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}`);
|