chore:little fixes and formating and linting and patches

This commit is contained in:
2026-03-31 15:50:54 +02:00
parent a1ce71ffb6
commit 9b197abcfa
815 changed files with 22960 additions and 8982 deletions

View File

@@ -156,7 +156,7 @@ export async function up() {
to: 'events_new_20251123',
batch: {
startDate: firstEventDate,
endDate: endDate,
endDate,
column: 'toDate(created_at)',
interval: 'month',
transform: (date: Date) => {
@@ -165,7 +165,7 @@ export async function up() {
return `${year}-${month}-01`;
},
},
}),
})
);
}
@@ -182,7 +182,7 @@ export async function up() {
!firstSessionDateJson[0]?.created_at.startsWith('1970')
) {
const firstSessionDate = new Date(
firstSessionDateJson[0]?.created_at ?? '',
firstSessionDateJson[0]?.created_at ?? ''
);
// Set endDate to first of next month to ensure we capture all data in the current month
const endDate = new Date();
@@ -234,7 +234,7 @@ export async function up() {
],
batch: {
startDate: firstSessionDate,
endDate: endDate,
endDate,
column: 'toDate(created_at)',
interval: 'month',
transform: (date: Date) => {
@@ -243,15 +243,15 @@ export async function up() {
return `${year}-${month}-01`;
},
},
}),
})
);
}
sqls.push(
...renameTable({ from: 'events', to: 'events_20251123', isClustered }),
...renameTable({ from: 'events', to: 'events_20251123', isClustered })
);
sqls.push(
...renameTable({ from: 'sessions', to: 'sessions_20251123', isClustered }),
...renameTable({ from: 'sessions', to: 'sessions_20251123', isClustered })
);
if (isClustered && sessionTables[1] && eventTables[1]) {
@@ -264,7 +264,7 @@ export async function up() {
`RENAME TABLE sessions_new_20251123_replicated TO sessions_replicated ON CLUSTER '{cluster}'`,
// Create new distributed tables
eventTables[1].replaceAll('events_new_20251123', 'events'), // creates a new distributed table
sessionTables[1].replaceAll('sessions_new_20251123', 'sessions'), // creates a new distributed table
sessionTables[1].replaceAll('sessions_new_20251123', 'sessions') // creates a new distributed table
);
} else {
sqls.push(
@@ -272,28 +272,28 @@ export async function up() {
from: 'events_new_20251123',
to: 'events',
isClustered,
}),
})
);
sqls.push(
...renameTable({
from: 'sessions_new_20251123',
to: 'sessions',
isClustered,
}),
})
);
}
fs.writeFileSync(
path.join(__filename.replace('.ts', '.sql')),
path.join(import.meta.filename.replace('.ts', '.sql')),
sqls
.map((sql) =>
sql
.trim()
.replace(/;$/, '')
.replace(/\n{2,}/g, '\n')
.concat(';'),
.concat(';')
)
.join('\n\n---\n\n'),
.join('\n\n---\n\n')
);
if (!process.argv.includes('--dry')) {