How to use the sequelize-typescript.Column function in sequelize-typescript

To help you get started, we’ve selected a few sequelize-typescript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oughtinc / mosaic / server / lib / models / assignment.ts View on Github external
@Column(DataType.BOOLEAN)
  public isOracle: boolean;

  @Column(DataType.BOOLEAN)
  public isTimed: boolean;

  @ForeignKey(() => Workspace)
  @Column(DataType.UUID)
  public workspaceId: string;

  @BelongsTo(() => Workspace)
  public Workspace: Workspace;

  @ForeignKey(() => Experiment)
  @Column(DataType.UUID)
  public experimentId: string;

  @BelongsTo(() => Experiment)
  public Experiments: Experiment;

  @HasMany(() => Snapshot)
  public snapshots: Snapshot[];
}
github oughtinc / mosaic / server / lib / models / pointerImport.ts View on Github external
@Table
export default class PointerImport extends Model {
  @Column({
    type: DataType.UUID,
    primaryKey: true,
    defaultValue: UUIDV4,
    allowNull: false,
  })
  public id: string;

  @Column(DataType.BOOLEAN)
  public isLocked: boolean;

  @ForeignKey(() => Pointer)
  @Column(DataType.UUID)
  public pointerId: string;

  @BelongsTo(() => Pointer)
  public pointer: Pointer;

  @ForeignKey(() => Workspace)
  @Column(DataType.UUID)
  public workspaceId: string;

  @BelongsTo(() => Workspace)
  public workspace: Workspace;
}
github RiseVision / rise-node / packages / core-models / src / models / ForksStatsModel.ts View on Github external
import { IForkStatsModel } from '@risevision/core-interfaces';
import { ForkType } from '@risevision/core-types';
import {
  Column,
  DataType,
  Model,
  PrimaryKey,
  Table,
} from 'sequelize-typescript';

@Table({ tableName: 'forks_stat' })
export class ForksStatsModel extends Model
  implements IForkStatsModel {
  @PrimaryKey
  @Column(DataType.BLOB)
  public generatorPublicKey: Buffer;

  @PrimaryKey
  @Column
  public blockTimestamp: number;

  @PrimaryKey
  @Column
  public blockId: string;

  @PrimaryKey
  @Column
  public blockHeight: number;

  @PrimaryKey
  @Column
github oughtinc / mosaic / server / lib / models / userTreeOracleRelation.ts View on Github external
Model,
  Table
} from "sequelize-typescript";
import User from "./user";
import Tree from "./tree";

@Table({ tableName: "UserTreeOracleRelation" })
export default class UserTreeOracleRelation extends Model<
  UserTreeOracleRelation
> {
  @Default(false)
  @Column(DataType.BOOLEAN)
  public isMalicious: boolean;

  @ForeignKey(() => User)
  @Column(DataType.UUID)
  public UserId: string;

  @BelongsTo(() => User)
  public user: User;

  @ForeignKey(() => Tree)
  @Column(DataType.UUID)
  public TreeId: string;

  @BelongsTo(() => Tree)
  public tree: User;
}