mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
Fix typeorm migrations (#297)
* fix: remove config parameter from typeorm cli and update config the config parameter is no longer supported since version 0.3 the config now needs to export a DataSource object to work with the 0.3 cli * fix: update all typeorm entities and migrations to be aligned with database structure * Fixed test-util import databaseConfig * Fixed column mismatch in raw query with new migration * Remove dist build directory when starting dev server Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
||||
import {Column, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, Unique} from 'typeorm';
|
||||
import { AlbumEntity } from './album.entity';
|
||||
import { AssetEntity } from './asset.entity';
|
||||
|
||||
@Entity('asset_album')
|
||||
@Unique('PK_unique_asset_in_album', ['albumId', 'assetId'])
|
||||
@Unique('UQ_unique_asset_in_album', ['albumId', 'assetId'])
|
||||
export class AssetAlbumEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
id!: string;
|
||||
@@ -12,6 +12,7 @@ export class AssetAlbumEntity {
|
||||
albumId!: string;
|
||||
|
||||
@Column()
|
||||
@OneToOne(() => AssetEntity, (entity) => entity.id)
|
||||
assetId!: string;
|
||||
|
||||
@ManyToOne(() => AlbumEntity, (album) => album.assets, {
|
||||
|
||||
@@ -26,10 +26,10 @@ export class AssetEntity {
|
||||
@Column({ type: 'varchar', nullable: true })
|
||||
resizePath!: string | null;
|
||||
|
||||
@Column({ type: 'varchar', nullable: true })
|
||||
@Column({ type: 'varchar', nullable: true, default: '' })
|
||||
webpPath!: string | null;
|
||||
|
||||
@Column({ type: 'varchar', nullable: true })
|
||||
@Column({ type: 'varchar', nullable: true, default: '' })
|
||||
encodedVideoPath!: string;
|
||||
|
||||
@Column()
|
||||
|
||||
@@ -73,4 +73,19 @@ export class ExifEntity {
|
||||
@OneToOne(() => AssetEntity, { onDelete: 'CASCADE', nullable: true })
|
||||
@JoinColumn({ name: 'assetId', referencedColumnName: 'id' })
|
||||
asset?: ExifEntity;
|
||||
|
||||
@Index("exif_text_searchable", { synchronize: false })
|
||||
@Column({
|
||||
type: 'tsvector',
|
||||
generatedType: 'STORED',
|
||||
asExpression: `TO_TSVECTOR('english',
|
||||
COALESCE(make, '') || ' ' ||
|
||||
COALESCE(model, '') || ' ' ||
|
||||
COALESCE(orientation, '') || ' ' ||
|
||||
COALESCE("lensModel", '') || ' ' ||
|
||||
COALESCE("city", '') || ' ' ||
|
||||
COALESCE("state", '') || ' ' ||
|
||||
COALESCE("country", ''))`
|
||||
})
|
||||
exifTextSearchableColumn!: string
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@ export class UserEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column()
|
||||
@Column({ default: '' })
|
||||
firstName!: string;
|
||||
|
||||
@Column()
|
||||
@Column({ default: '' })
|
||||
lastName!: string;
|
||||
|
||||
@Column()
|
||||
@Column({ default: false })
|
||||
isAdmin!: boolean;
|
||||
|
||||
@Column()
|
||||
@@ -23,10 +23,10 @@ export class UserEntity {
|
||||
@Column({ select: false })
|
||||
salt?: string;
|
||||
|
||||
@Column()
|
||||
@Column({ default: '' })
|
||||
profileImagePath!: string;
|
||||
|
||||
@Column()
|
||||
@Column({ default: true })
|
||||
shouldChangePassword!: boolean;
|
||||
|
||||
@CreateDateColumn()
|
||||
|
||||
Reference in New Issue
Block a user