feat(gateway): include production Telegram user gateway
Version the NestJS TDLib gateway with Docker deployment, migrations, automated tests and platform integration documentation while excluding all account sessions, credentials, runtime databases and backups.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import * as entities from '../src/database/entities';
|
||||
import { InitialSchema1700000000000 } from '../src/database/migrations/1700000000000-InitialSchema';
|
||||
|
||||
describe('Initial database migration', () => {
|
||||
it('creates the complete schema without synchronize', async () => {
|
||||
const dataSource = new DataSource({
|
||||
type: 'sqljs',
|
||||
entities: Object.values(entities).filter(
|
||||
(value) => typeof value === 'function',
|
||||
) as Function[],
|
||||
migrations: [InitialSchema1700000000000],
|
||||
synchronize: false,
|
||||
migrationsRun: true,
|
||||
});
|
||||
|
||||
await dataSource.initialize();
|
||||
try {
|
||||
const tables = await dataSource.query(
|
||||
"SELECT name FROM sqlite_master WHERE type='table'",
|
||||
);
|
||||
const names = new Set(tables.map((row: { name: string }) => row.name));
|
||||
expect(names.has('tenants')).toBe(true);
|
||||
expect(names.has('users')).toBe(true);
|
||||
expect(names.has('tg_accounts')).toBe(true);
|
||||
expect(names.has('tg_messages')).toBe(true);
|
||||
expect(names.has('tg_webhook_deliveries')).toBe(true);
|
||||
expect(names.has('tg_raw_updates')).toBe(true);
|
||||
} finally {
|
||||
await dataSource.destroy();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user