-
-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Unexpected default for generated entity with boolean property
To Reproduce
Steps to reproduce the behavior:
- Create the following table in a mysql database
CREATE TABLE `test_table` (
`test_column` tinyint(1) not null default 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- Run the following script to autogenerate entities based on the database above
ts-node generateEntities.ts
import { MikroORM } from '@mikro-orm/core';
(async () => {
const orm = await MikroORM.init({
discovery: {
// we need to disable validation for no entities
warnWhenNoEntities: false,
},
dbName: dbName
....
});
const generator = orm.getEntityGenerator();
const dump = await generator.generate({
save: true,
baseDir: process.cwd() + '/my-entities',
});
console.log(dump);
await orm.close(true);
})();
Expected behavior
I would expect the generated entity to have a boolean property defaulting to False but the property is actually defaulting to True.
This is the actual autogenerated entity
import { Entity, Property } from '@mikro-orm/core';
@Entity()
export class TestTable {
@Property()
testColumn: boolean = true;
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working