-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
hello. While using the library, I felt uncomfortable and entered an issue.
The situation is as follows.
- node 18.11.0
- adminjs 7.0.9
- @adminjs/sql 2.1.0
- DB: mariadb
- connect type: mysql2
This is the code I set up.
const PORT = 3000;
const start = async () => {
const db = await new Adapter("mysql2", {
user: "user",
password: "my_db_password",
host: "my_db_host",
port: <my_db_port>,
database: "db_name",
}).init();
AdminJS.registerAdapter({ Database, Resource });
const app = Fastify();
const admin = new AdminJS({
resources: [
{
resource: db.table("user"),
options: {},
},
],
rootPath: "/admin",
});
await AdminJSFastify.buildRouter(admin, app);
app.listen({ port: PORT }, (err, addr) => {
if (err) {
console.error(err);
} else {
console.log(
`AdminJS started on http://localhost:${PORT}${admin.options.rootPath}`
);
}
});
};
start();
But here an error occurred. The error contents are as follows.
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at getColumnInfo (file:///C:/kkn_folder/project/uglymews/node_modules/@adminjs/sql/lib/dialects/mysql.parser.j
s:5:35)
at file:///C:/kkn_folder/project/uglymews/node_modules/@adminjs/sql/lib/dialects/mysql.parser.js:141:50
at Array.map (<anonymous>)
at MysqlParser.getProperties (file:///C:/kkn_folder/project/uglymews/node_modules/@adminjs/sql/lib/dialects/my
sql.parser.js:141:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///C:/kkn_folder/project/uglymews/node_modules/@adminjs/sql/lib/dialects/mysql.parser.js:117:138
at async Promise.all (index 1)
at async MysqlParser.getResources (file:///C:/kkn_folder/project/uglymews/node_modules/@adminjs/sql/lib/dialec
ts/mysql.parser.js:115:27)
at async MysqlParser.parse (file:///C:/kkn_folder/project/uglymews/node_modules/@adminjs/sql/lib/dialects/mysq
l.parser.js:88:27)
at async start (file:///C:/kkn_folder/project/uglymews/admin/admin.js:9:14)
file:///C:/kkn_folder/project/uglymews/node_modules/@adminjs/sql/lib/metadata/DatabaseMetadata.js:14
throw new Error(`Table does not exist: "${this.database}.${tableName}"`);
^
Error: Table does not exist: "my_db.user"
at DatabaseMetadata.table (file:///C:/kkn_folder/project/uglymews/node_modules/@adminjs/sql/lib/metadata/Datab
aseMetadata.js:14:19)
I saw here why "toLowerCase" doesn't work. This happened because the field name of the variable obtained from "knex" is lowercase.


So, I am currently using it only for the project I am using after partially modifying it.
The modified part is the part changed to "col.UPPERCASE" in the right image above. After making the changes, it worked fine.
I specified and used "mysql2" as the db type, but the actual DB being used is "MariaDB". If "mariadb" is not compatible, I think this part needs to be resolved.
Metadata
Metadata
Assignees
Labels
No labels