How to use the typeorm.Column function in typeorm

To help you get started, we’ve selected a few typeorm 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 Kononnable / typeorm-model-generator / test / integration / entityTypes / mssql / entity / Post.ts View on Github external
@Column("sql_variant")
    sql_variant: string;

    @Column("timestamp")
    timestamp: Date;

    @Column("uniqueidentifier")
    uniqueidentifier: string;

    @Column("xml")
    xml: string;

    @Column("geometry")
    geometry: string;

    @Column("geography")
    geography: string;

}
github antonversal / typeorm-factory / __tests__ / fixtures / entity / Post.ts View on Github external
export enum PostType {
  TEXT = "TEXT",
  IMAGE = "IMAGE",
}

@Entity()
export class Post {

  @PrimaryGeneratedColumn()
  public id: number;

  @Column("varchar")
  public title: string;

  @Column("varchar")
  public text: string;

  @Column("int", { nullable: false })
  public likesCount: number;

  @Column("varchar", { nullable: false })
  public postType: PostType;

  @OneToMany(() => Comment, (comment) => comment.post)
  public comments: Comment[];

  @ManyToOne(() => Author, (author) => author.posts)
  public author: Author;
}
github Kononnable / typeorm-model-generator / test / integration / entityTypes / mssql / entity / Post.ts View on Github external
@Column("bigint")
    bigint: string;

    @Column("bit")
    bit: boolean;

    @Column("decimal")
    decimal: number;

    @Column("int")
    int: number;

    @Column("money")
    money: number;

    @Column("numeric")
    numeric: number;

    @Column("smallint")
    smallint: number;

    @Column("smallmoney")
    smallmoney: number;

    @Column("tinyint")
    tinyint: number;

    @Column("float")
    float: number;

    @Column("real")
    real: number;
github danelkhen / desktopbrowser / server / src / testtypeorm.ts View on Github external
import { createConnection } from "typeorm";

import { Table, Column, PrimaryGeneratedColumn } from "typeorm";

@Table()
export class Photo {

    @PrimaryGeneratedColumn()
    id: number;

    @Column({
        length: 500
    })
    name: string;

    @Column("text")
    description: string;

    @Column()
    fileName: string;

    @Column("int")
    views: number;

    @Column()
    isPublished: boolean;
}

createConnection({
    driver: {
        type: "sqlite",
        host: "localhost",
github Kononnable / typeorm-model-generator / test / integration / entityTypes / postgres / entity / Post.ts View on Github external
@Column("numeric")
    numeric: string;

    @Column("real")
    real: number;

    @Column("float")
    float: number;

    @Column("float4")
    float4: number;

    @Column("float8")
    float8: number;

    @Column("double precision")
    doublePrecision: number;

    @Column("money")
    money: string;

    @Column("character varying")
    characterVarying: string;

    @Column("varchar")
    varchar: string;

    @Column("character")
    character: string;

    @Column("char")
    char: string;
github velopert / velog-server / src / entity / SeriesPosts.ts View on Github external
export default class SeriesPosts {
  @PrimaryGeneratedColumn('uuid')
  id!: string;

  @Index()
  @Column('uuid')
  fk_series_id!: string;

  @Index()
  @Column('uuid')
  fk_post_id!: string;

  @Column('int4')
  index!: number;

  @Column('timestampz')
  @CreateDateColumn()
  created_at!: Date;

  @Column('timestamptz')
  @UpdateDateColumn()
  updated_at!: Date;

  @ManyToOne(type => Post, { cascade: true, eager: true })
  @JoinColumn({ name: 'fk_post_id' })
  post!: Post;

  @ManyToOne(type => Series, { cascade: true, eager: true })
  @JoinColumn({ name: 'fk_series_id' })
  series!: Series;
}
github mpcast / mpcast-server / packages / core / dist / entity / options / option.entity.js View on Github external
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const class_validator_1 = require("class-validator");
const typeorm_1 = require("typeorm");
const typeorm_2 = require("typeorm");
let Option = class Option {
};
__decorate([
    typeorm_2.Column({ type: 'varchar', length: 100 }),
    typeorm_1.PrimaryColumn(),
    __metadata("design:type", String)
], Option.prototype, "key", void 0);
__decorate([
    typeorm_2.Column('json', {
        nullable: true,
        comment: '元信息值',
    }),
    class_validator_1.IsJSON(),
    __metadata("design:type", Object)
], Option.prototype, "value", void 0);
__decorate([
    typeorm_2.Column('varchar', {
        nullable: true,
        length: 200,
        comment: '配置项描述',
    }),
    __metadata("design:type", String)
], Option.prototype, "description", void 0);
Option = __decorate([
    typeorm_1.Entity('options'),
github new-eden-social / new-eden-social / src / api / src / modules / notification / notification.entity.ts View on Github external
@Entity()
export class Notification extends AggregateRoot {

  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  eventUuid: string;

  @CreateDateColumn()
  createdAt: Date;

  @Column({ nullable: true })
  seenAt: Date;

  @Column('varchar')
  type: NOTIFICATION_TYPE;

  @ManyToOne(type => Character)
  recipient: Character;

  @ManyToOne(type => Character, null, { nullable: true, eager: true })
  senderCharacter?: Character;

  @ManyToOne(type => Corporation, null, { nullable: true, eager: true })
  senderCorporation?: Corporation;

  @ManyToOne(type => Alliance, null, { nullable: true, eager: true })
  senderAlliance?: Alliance;

  @ManyToOne(type => Post, null, { nullable: true })
  post?: Post;
github brookshi / Hitchhiker / api / models / collection.ts View on Github external
@OneToMany(_type => Record, record => record.collection, {
        cascadeInsert: true
    })
    records: Record[];

    @Column('mediumtext', { nullable: true })
    commonPreScript: string;

    @Column({ default: false })
    reqStrictSSL: boolean;

    @Column({ default: false })
    reqFollowRedirect: boolean;

    @Column('text', { nullable: true })
    description: string;

    @JoinColumn()
    @OneToOne(_type => User)
    owner: User;

    @ManyToOne(_type => Project, project => project.collections)
    project: Project;

    @Column({ default: false })
    recycle: boolean;

    @Column({ default: true })
    public: boolean;

    @Column('json', { nullable: true })
github benawad / fullstack-graphql-airbnb-clone / packages / server / src / entity / Listing.ts View on Github external
@Column("text", { nullable: true })
  pictureUrl: string;

  @Column("varchar", { length: 255 })
  description: string;

  @Column("int") price: number;

  @Column("int") beds: number;

  @Column("int") guests: number;

  @Column("double precision") latitude: number;

  @Column("double precision") longitude: number;

  @Column("text", { array: true })
  amenities: string[];

  @Column("uuid") userId: string;

  @ManyToOne(() => User, user => user.listings)
  user: User;
}