mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat: rename schema (#19891)
This commit is contained in:
parent
33c29e4305
commit
c699df002a
103 changed files with 4378 additions and 3224 deletions
|
|
@ -9,13 +9,7 @@ import { ConfigRepository } from 'src/repositories/config.repository';
|
|||
import { DatabaseRepository } from 'src/repositories/database.repository';
|
||||
import { LoggingRepository } from 'src/repositories/logging.repository';
|
||||
import 'src/schema';
|
||||
import {
|
||||
DefaultNamingStrategy,
|
||||
HashNamingStrategy,
|
||||
schemaDiff,
|
||||
schemaFromCode,
|
||||
schemaFromDatabase,
|
||||
} from 'src/sql-tools';
|
||||
import { schemaDiff, schemaFromCode, schemaFromDatabase } from 'src/sql-tools';
|
||||
import { asPostgresConnectionConfig, getKyselyConfig } from 'src/utils/database';
|
||||
|
||||
const main = async () => {
|
||||
|
|
@ -113,22 +107,7 @@ const compare = async () => {
|
|||
const { database } = configRepository.getEnv();
|
||||
const db = postgres(asPostgresConnectionConfig(database.config));
|
||||
|
||||
const tables = new Set<string>();
|
||||
const preferred = new DefaultNamingStrategy();
|
||||
const fallback = new HashNamingStrategy();
|
||||
|
||||
const source = schemaFromCode({
|
||||
overrides: true,
|
||||
namingStrategy: {
|
||||
getName(item) {
|
||||
if ('tableName' in item && tables.has(item.tableName)) {
|
||||
return preferred.getName(item);
|
||||
}
|
||||
|
||||
return fallback.getName(item);
|
||||
},
|
||||
},
|
||||
});
|
||||
const source = schemaFromCode({ overrides: true, namingStrategy: 'default' });
|
||||
const target = await schemaFromDatabase(db, {});
|
||||
|
||||
console.log(source.warnings.join('\n'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue