T-57: M1.3b — trial_ledger + vault_evaluations append-only PostgreSQL migration (research track)
This commit is contained in:
parent
2ea7316af6
commit
5025286e49
8 changed files with 920 additions and 11 deletions
|
|
@ -77,6 +77,7 @@ const RESEARCH_FILES = [
|
|||
'31-research-agent-project-links.sql',
|
||||
'32-candidate-parameter-defaults.sql',
|
||||
'33-candidate-decimal-normalization.sql',
|
||||
'36-trial-ledger.sql',
|
||||
];
|
||||
|
||||
const cleanup: (() => Promise<void> | void)[] = [];
|
||||
|
|
@ -137,13 +138,13 @@ async function createIsolatedFixture() {
|
|||
}
|
||||
|
||||
describe.skipIf(!url)('fresh PostgreSQL database schema', () => {
|
||||
test('Case A: init SQL 01-35 contain no CREATE DATABASE/\\c and create all master and research tables', async () => {
|
||||
test('Case A: init SQL 01-36 contain no CREATE DATABASE/\\c and create all master and research tables', async () => {
|
||||
const f = await createIsolatedFixture();
|
||||
const sqlFiles = readdirSync(initDir)
|
||||
.filter(file => file.endsWith('.sql'))
|
||||
.sort();
|
||||
|
||||
expect(sqlFiles.length).toBeGreaterThanOrEqual(35);
|
||||
expect(sqlFiles.length).toBeGreaterThanOrEqual(36);
|
||||
|
||||
for (const file of sqlFiles) {
|
||||
const sql = readFileSync(join(initDir, file), 'utf8');
|
||||
|
|
@ -158,7 +159,7 @@ describe.skipIf(!url)('fresh PostgreSQL database schema', () => {
|
|||
...LEGACY_MASTER_TABLES,
|
||||
// Security master tables (34)
|
||||
...SECURITY_MASTER_TABLES,
|
||||
// Research tables (06-33, including representatives from 12, 16, 20, 22, 28, 30)
|
||||
// Research tables (06-33, 36, including representatives from 12, 16, 20, 22, 28, 30, 36)
|
||||
'backtests',
|
||||
'backtest_results',
|
||||
'runs',
|
||||
|
|
@ -168,6 +169,8 @@ describe.skipIf(!url)('fresh PostgreSQL database schema', () => {
|
|||
'research_experiments',
|
||||
'research_agents',
|
||||
'paper_deployments',
|
||||
'trial_ledger',
|
||||
'vault_evaluations',
|
||||
]) {
|
||||
expect(createdTables.has(expectedTable)).toBe(true);
|
||||
}
|
||||
|
|
@ -188,6 +191,8 @@ describe.skipIf(!url)('fresh PostgreSQL database schema', () => {
|
|||
for (const table of [...LEGACY_MASTER_TABLES, ...SECURITY_MASTER_TABLES]) {
|
||||
expect(createdTables.has(table)).toBe(true);
|
||||
}
|
||||
expect(createdTables.has('trial_ledger')).toBe(false);
|
||||
expect(createdTables.has('vault_evaluations')).toBe(false);
|
||||
expect(await f.hasColumn('exchanges', 'visible')).toBe(true);
|
||||
|
||||
const second = await runPostgresMigrations(f.postgres, { track: 'master' });
|
||||
|
|
@ -195,7 +200,7 @@ describe.skipIf(!url)('fresh PostgreSQL database schema', () => {
|
|||
expect(await f.recorded()).toEqual(MASTER_FILES);
|
||||
});
|
||||
|
||||
test('Case C: all track with 06-08 pre-applied records master + 09-33 and never records 06-08', async () => {
|
||||
test('Case C: all track with 06-08 pre-applied records master + research (including 36) and never records 06-08', async () => {
|
||||
const f = await createIsolatedFixture();
|
||||
|
||||
for (const file of BOOTSTRAP_FILES) {
|
||||
|
|
@ -216,6 +221,8 @@ describe.skipIf(!url)('fresh PostgreSQL database schema', () => {
|
|||
for (const table of [...LEGACY_MASTER_TABLES, ...SECURITY_MASTER_TABLES]) {
|
||||
expect(createdTables.has(table)).toBe(true);
|
||||
}
|
||||
expect(createdTables.has('trial_ledger')).toBe(true);
|
||||
expect(createdTables.has('vault_evaluations')).toBe(true);
|
||||
|
||||
const second = await runPostgresMigrations(f.postgres, { track: 'all' });
|
||||
expect(second).toEqual([]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue