-
-
Notifications
You must be signed in to change notification settings - Fork 495
Replies: 1 comment · 8 replies
-
This is not about closing the ORM, but rather about how Will take a closer look. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Perfect, the error is gone! But now I see that using @Entity({
tableName: 'a',
})
export class AEntity {
@PrimaryKey()
public id: number;
@Property({
check: "name ~* '^[A-Za-z0-9_-]+$'", // <-----
columnType: 'varchar',
comment: 'Unique username per user.',
length: 30,
type: 'string',
unique: true,
})
public name!: string;
}
|
Beta Was this translation helpful? Give feedback.
All reactions
-
It works fine for me locally. Maybe you have safe mode enabled? As you don't have any |
Beta Was this translation helpful? Give feedback.
All reactions
-
Hum, strange that it work for you, did you try the last changes I uploaded? Here is the complete log of the test.
|
Beta Was this translation helpful? Give feedback.
All reactions
-
Ok I see whats happening. Its not about clearing existing things, some queries literally try to create the same constraint multiple times: create table "a" (
"id" serial primary key,
"name" varchar not null,
constraint a_name_check check (name ~* '^[A-Za-z0-9_-]+$'),
constraint a_name_check check (name ~* '^[A-Za-z0-9_-]+$')); That's because of global/decorator metadata storage is not being cleared, but the require cache is not present apparently. FYI if you remove Will try to do some deduplication during discovery, it should easy, there are more things than just the check constraints that can suffer from this. edit: here you go fb523c8?w=1 |
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 2
-
Thank you, all my errors have been solved! |
Beta Was this translation helpful? Give feedback.
All reactions
This discussion was converted from issue #4732 on September 23, 2023 06:13.
-
Describe the bug
I am trying to do unit testing with vites, nestjs (testing module) and mikro-orm. My problem is that the first test suite runs successfully, but when trying to run the next test suite, I get an error.
The error says that I have already loaded the entities and therefore I can no longer load it in suit 2, but I don't understand why if I already closed the mikro-orm client in suit 1.
So, I don't know if I'm closing the client wrong in the suits, or I don't know what's going on.
Stack trace
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No error on entities, since I do not understand the reason why this happens if they are two totally different suits.
Additional context
I think the problem is in
await orm.getSchemaGenerator().refreshDatabase();
, but I am not sure.Versions
Beta Was this translation helpful? Give feedback.
All reactions