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.
49 lines (34 loc) • 990 B
text/typescript
import { Entity, PrimaryKey, Property, MikroORM, Index, Unique } from '@mikro-orm/sqlite';
abstract class A {
()
id!: number;
()
()
foo?: string;
()
()
bar?: string;
}
()
class B extends A {
()
name!: string;
}
describe('GH issue 463', () => {
let orm: MikroORM;
beforeAll(async () => {
orm = await MikroORM.init({
entities: [A, B],
dbName: ':memory:',
});
await orm.schema.dropSchema();
await orm.schema.createSchema();
});
afterAll(() => orm.close(true));
test(`multiple inheritance`, async () => {
const sql = 'create table `b` (`id` integer not null primary key autoincrement, `foo` text not null, `bar` text not null, `name` text not null);\n' +
'create index `b_foo_index` on `b` (`foo`);\n' +
'create unique index `b_bar_unique` on `b` (`bar`);\n\n';
expect(await orm.schema.getCreateSchemaSQL({ wrap: false })).toBe(sql);
});
});