immich/server/test/sql-tools/column-unique-constraint-name-override.stub.ts

47 lines
1 KiB
TypeScript
Raw Normal View History

2025-07-03 10:59:17 -04:00
import { Column, ConstraintType, DatabaseSchema, Table } from 'src/sql-tools';
2025-03-28 10:40:09 -04:00
@Table()
export class Table1 {
@Column({ type: 'uuid', unique: true, uniqueConstraintName: 'UQ_test' })
id!: string;
}
export const description = 'should create a unique key constraint with a specific name';
export const schema: DatabaseSchema = {
2025-07-03 10:59:17 -04:00
databaseName: 'postgres',
schemaName: 'public',
functions: [],
enums: [],
extensions: [],
parameters: [],
2025-03-28 10:40:09 -04:00
tables: [
{
name: 'table1',
columns: [
{
name: 'id',
tableName: 'table1',
type: 'uuid',
nullable: false,
isArray: false,
primary: false,
synchronize: true,
},
],
indexes: [],
triggers: [],
2025-03-28 10:40:09 -04:00
constraints: [
{
2025-07-03 10:59:17 -04:00
type: ConstraintType.UNIQUE,
2025-03-28 10:40:09 -04:00
name: 'UQ_test',
tableName: 'table1',
columnNames: ['id'],
synchronize: true,
},
],
synchronize: true,
},
],
warnings: [],
};