You've already forked immich
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:
@ -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)'],
|
||||
};
|
Reference in New Issue
Block a user