1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-09 23:17:29 +02:00

feat(server): sql-tools support for class level composite fk (#19242)

* feat: support for class level composite fk

* chore: clean up

---------

Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
SGT
2025-06-18 15:30:39 -03:00
committed by GitHub
parent de81006367
commit 0a9a520ed2
19 changed files with 865 additions and 30 deletions

View File

@ -0,0 +1,44 @@
import { Column, DatabaseSchema, ForeignKeyConstraint, Table } from 'src/sql-tools';
class Foo {}
@Table()
@ForeignKeyConstraint({
columns: ['parentId'],
referenceTable: () => Foo,
})
export class Table1 {
@Column()
parentId!: string;
}
export const description = 'should warn against missing reference table';
export const schema: DatabaseSchema = {
name: 'postgres',
schemaName: 'public',
functions: [],
enums: [],
extensions: [],
parameters: [],
tables: [
{
name: 'table1',
columns: [
{
name: 'parentId',
tableName: 'table1',
type: 'character varying',
nullable: false,
isArray: false,
primary: false,
synchronize: true,
},
],
indexes: [],
triggers: [],
constraints: [],
synchronize: true,
},
],
warnings: ['[@ForeignKeyConstraint.referenceTable] Unable to find table (Foo)'],
};