Commit b3c7fabe authored by nanahira's avatar nanahira

small fix of model

parent 66a7d29a
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Build } from './Build.entity';
import { Index } from 'typeorm/browser';
export enum ArchiveType {
Full = 'full',
Update = 'update',
Part = 'part'
Part = 'part',
}
@Entity()
......@@ -15,13 +16,11 @@ export class Archive {
@Column('varchar', { length: 256, array: true })
files: string[];
@Column('varchar', { length: 64 })
@Index()
@Column('varchar', { length: 140 })
path: string;
@Column({ type: 'bytea', length: 64 })
checksum: Buffer;
@ManyToOne(type => Build, build => build.archives)
@ManyToOne((type) => Build, (build) => build.archives)
build: Build;
@Column({ type: 'enum', enum: ArchiveType })
......
import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { Depot } from './Depot.entity';
import { Archive } from './Archive.entity';
import { Index } from 'typeorm/browser';
@Entity()
export class Build {
@PrimaryGeneratedColumn()
id: number;
@Index()
@Column()
version: string;
@ManyToOne(type => Depot, depot => depot.builds)
@ManyToOne((type) => Depot, (depot) => depot.builds)
depot: Depot;
@OneToMany(type => Archive, archive => archive.build)
@OneToMany((type) => Archive, (archive) => archive.build)
archives: Archive[];
@Column({ type: 'hstore', hstoreType: 'object' })
......
......@@ -2,24 +2,27 @@ import { Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn } f
import { App } from './App.entity';
import { Build } from './Build.entity';
@Index(d => [d.app, d.locale, d.platform.d.arch], { unique: true })
@Index((d) => [d.app, d.locale, d.platform.d.arch], { unique: true })
@Entity()
export class Depot {
@PrimaryGeneratedColumn()
id: number;
@Index()
@Column({ default: 'generic' })
locale: string;
@Index()
@Column({ default: 'generic' })
platform: string;
@Index()
@Column({ default: 'generic' })
arch: string;
@ManyToOne(type => App, app => app.depots)
@ManyToOne((type) => App, (app) => app.depots)
app: App;
@OneToMany(() => Build, build => build.depot)
@OneToMany(() => Build, (build) => build.depot)
builds: Build[];
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment