mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 02:27:08 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			47 lines
		
	
	
		
			1023 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1023 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { Column, DatabaseConstraintType, DatabaseSchema, Table } from 'src/sql-tools';
 | |
| 
 | |
| @Table()
 | |
| export class Table1 {
 | |
|   @Column({ type: 'uuid', unique: true })
 | |
|   id!: string;
 | |
| }
 | |
| 
 | |
| export const description = 'should create a unique key constraint with a default name';
 | |
| export const schema: DatabaseSchema = {
 | |
|   name: 'postgres',
 | |
|   schemaName: 'public',
 | |
|   functions: [],
 | |
|   enums: [],
 | |
|   extensions: [],
 | |
|   parameters: [],
 | |
|   tables: [
 | |
|     {
 | |
|       name: 'table1',
 | |
|       columns: [
 | |
|         {
 | |
|           name: 'id',
 | |
|           tableName: 'table1',
 | |
|           type: 'uuid',
 | |
|           nullable: false,
 | |
|           isArray: false,
 | |
|           primary: false,
 | |
|           synchronize: true,
 | |
|         },
 | |
|       ],
 | |
|       indexes: [],
 | |
|       triggers: [],
 | |
|       constraints: [
 | |
|         {
 | |
|           type: DatabaseConstraintType.UNIQUE,
 | |
|           name: 'UQ_b249cc64cf63b8a22557cdc8537',
 | |
|           tableName: 'table1',
 | |
|           columnNames: ['id'],
 | |
|           synchronize: true,
 | |
|         },
 | |
|       ],
 | |
|       synchronize: true,
 | |
|     },
 | |
|   ],
 | |
|   warnings: [],
 | |
| };
 |