undeexcepturi
Version:
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.
42 lines (30 loc) • 876 B
text/typescript
import { Entity, MikroORM, PrimaryKey, Property } from '@mikro-orm/postgresql';
({
tableName: 'test.DEVICES',
})
export class Device {
({ fieldName: 'ID', type: 'number' })
id!: number;
({ fieldName: 'TOKEN' })
token!: string;
}
describe('GH issue 1143', () => {
let orm: MikroORM;
beforeAll(async () => {
orm = await MikroORM.init({
entities: [Device],
dbName: `mikro_orm_test_gh_1143`,
});
await orm.schema.ensureDatabase();
await orm.schema.dropSchema();
await orm.schema.execute(`drop schema if exists "test" cascade`);
await orm.schema.createSchema();
});
afterAll(async () => {
await orm.close(true);
});
it('diffing schema with custom schema name', async () => {
const sql = await orm.schema.getUpdateSchemaSQL({ wrap: false });
expect(sql).toBe('');
});
});