How to use the typeorm.Table 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 timwhit / enterprise-node-typescript / src / model / AddressSchema.ts View on Github external
public country: string;
}

class AddressDatabase extends Core {
    public Addresses = new Model(this, AddressMongoSchema);
}

export const mongoDatabase = new AddressDatabase({database: 'test_db'});

// delete everything from mongo
// database.connect().then(() => database.Addresses.remove()).then(() => database.Addresses.get()).then(() => database.close());

/**
 * TypeORM Schema Config
 */
@Table('address')
export class AddressDbSchema implements AddressDTO {
    @PrimaryColumn()
    // tslint:disable-next-line:variable-name
    public _id?: string;
    @Column()
    public address1: string;
    @Column()
    public address2?: string;
    @Column()
    public city: string;
    @Column()
    public state: string;
    @Column()
    public zip: string;
    @Column()
    public country: string;
github 0xProject / 0x-monorepo / packages / pipeline / migrations / 1542070840010-InitialSchema.ts View on Github external
{ name: 'raw_maker_asset_data', type: 'varchar' },
        { name: 'maker_asset_type', type: 'varchar' },
        { name: 'maker_asset_proxy_id', type: 'varchar' },
        { name: 'maker_token_address', type: 'char(42)' },
        { name: 'maker_token_id', type: 'varchar', isNullable: true },
        { name: 'raw_taker_asset_data', type: 'varchar' },
        { name: 'taker_asset_type', type: 'varchar' },
        { name: 'taker_asset_proxy_id', type: 'varchar' },
        { name: 'taker_token_address', type: 'char(42)' },
        { name: 'taker_token_id', type: 'varchar', isNullable: true },

        { name: 'metadata_json', type: 'varchar' },
    ],
});

const token_on_chain_metadata = new Table({
    name: 'raw.token_on_chain_metadata',
    columns: [
        { name: 'address', type: 'char(42)', isPrimary: true },
        { name: 'decimals', type: 'integer' },
        { name: 'symbol', type: 'varchar' },
        { name: 'name', type: 'varchar' },
    ],
});

const transactions = new Table({
    name: 'raw.transactions',
    columns: [
        { name: 'block_number', type: 'bigint', isPrimary: true },
        { name: 'block_hash', type: 'varchar', isPrimary: true },
        { name: 'transaction_hash', type: 'varchar', isPrimary: true },
        { name: 'gas_used', type: 'bigint' },
github rucken / core-nestjs / libs / rucken / auth-nestjs / src / migrations / 1533634559617-AddOauthTokensAccesstokenTable.ts View on Github external
public async up(queryRunner: QueryRunner): Promise {
    await queryRunner.createTable(
      new Table({
        name: 'oauth_tokens_accesstokens',
        columns: [
          {
            name: 'id',
            type: 'integer'
          },
          {
            name: 'provider',
            type: 'varchar(20)',
            isNullable: false
          },
          {
            name: 'provider_client_id',
            type: 'varchar(200)',
            isNullable: false
          },
github Xetera / HifumiOld / src / database / migrations / 1524911593961-usersPatch.ts View on Github external
public async up(queryRunner: QueryRunner): Promise {
        await queryRunner.createTable(new Table({
            name: 'users',
            columns: [
                new TableColumn({
                    name: 'id',
                    type: 'varchar',
                    isPrimary: true,
                    isNullable: false
                }), new TableColumn({
                    name: 'guild_id',
                    type: 'varchar',
                    isPrimary: true,
                    isNullable: false
                }),new TableColumn({
                    name: 'invite_strikes',
                    type: 'integer',
                    default: 0
github 0xProject / 0x-monorepo / packages / pipeline / migrations / 1542070840010-InitialSchema.ts View on Github external
name: 'raw.exchange_cancel_up_to_events',
    columns: [
        { name: 'contract_address', type: 'char(42)', isPrimary: true },
        { name: 'log_index', type: 'integer', isPrimary: true },
        { name: 'block_number', type: 'bigint', isPrimary: true },

        { name: 'raw_data', type: 'varchar' },

        { name: 'transaction_hash', type: 'varchar' },
        { name: 'maker_address', type: 'char(42)' },
        { name: 'sender_address', type: 'char(42)' },
        { name: 'order_epoch', type: 'varchar' },
    ],
});

const exchange_fill_events = new Table({
    name: 'raw.exchange_fill_events',
    columns: [
        { name: 'contract_address', type: 'char(42)', isPrimary: true },
        { name: 'log_index', type: 'integer', isPrimary: true },
        { name: 'block_number', type: 'bigint', isPrimary: true },

        { name: 'raw_data', type: 'varchar' },

        { name: 'transaction_hash', type: 'varchar' },
        { name: 'maker_address', type: 'char(42)' },
        { name: 'taker_address', type: 'char(42)' },
        { name: 'fee_recipient_address', type: 'char(42)' },
        { name: 'sender_address', type: 'char(42)' },
        { name: 'maker_asset_filled_amount', type: 'varchar' },
        { name: 'taker_asset_filled_amount', type: 'varchar' },
        { name: 'maker_fee_paid', type: 'varchar' },
github 0xProject / 0x-monorepo / packages / pipeline / migrations / 1549856835629-CreateSlippageTable.ts View on Github external
import { MigrationInterface, QueryRunner, Table } from 'typeorm';

const slippage = new Table({
    name: 'raw.slippage',
    columns: [
        { name: 'observed_timestamp', type: 'bigint', isPrimary: true },
        { name: 'symbol', type: 'varchar', isPrimary: true },
        { name: 'exchange', type: 'varchar', isPrimary: true },
        { name: 'usd_amount', type: 'numeric', isPrimary: true },

        { name: 'token_amount', type: 'numeric', isNullable: false },
        { name: 'avg_price_in_eth_buy', type: 'numeric', isNullable: true },
        { name: 'avg_price_in_eth_sell', type: 'numeric', isNullable: true },
        { name: 'slippage', type: 'numeric', isNullable: true },
    ],
});

export class CreateSlippageTable1549856835629 implements MigrationInterface {
    public async up(queryRunner: QueryRunner): Promise {
github Saluki / nestjs-template / src / migrations / 1533302442199-PassengerMigration.ts View on Github external
},
                {
                    name: 'first_name',
                    type: 'varchar',
                    length: '50'
                },
                {
                    name: 'last_name',
                    type: 'varchar',
                    length: '50'
                }
            ]
        };

        await queryRunner.createTable(
            new Table(tableOptions)
        );
    }
github Dragory / ZeppelinBot / backend / src / migrations / 1550521627877-CreateSelfGrantableRolesTable.ts View on Github external
public async up(queryRunner: QueryRunner): Promise {
    await queryRunner.createTable(
      new Table({
        name: "self_grantable_roles",
        columns: [
          {
            name: "id",
            type: "int",
            unsigned: true,
            isGenerated: true,
            generationStrategy: "increment",
            isPrimary: true,
          },
          {
            name: "guild_id",
            type: "bigint",
            unsigned: true,
          },
          {
github 0xProject / 0x-monorepo / packages / pipeline / migrations / 1552044685566-CreateGithubFork.ts View on Github external
import { MigrationInterface, QueryRunner, Table } from 'typeorm';

const table = new Table({
    name: 'raw.github_fork',
    columns: [
        { name: 'observed_timestamp', type: 'numeric', isPrimary: true },
        { name: 'full_name', type: 'varchar', isPrimary: true },
        { name: 'owner_login', type: 'varchar', isPrimary: true },

        { name: 'created_at', type: 'numeric', isNullable: false },
        { name: 'updated_at', type: 'numeric', isNullable: false },
        { name: 'pushed_at', type: 'numeric', isNullable: false },
        { name: 'size', type: 'numeric', isNullable: false },
        { name: 'stargazers', type: 'numeric', isNullable: false },
        { name: 'watchers', type: 'numeric', isNullable: false },
        { name: 'forks', type: 'numeric', isNullable: false },
        { name: 'open_issues', type: 'numeric', isNullable: false },
        { name: 'network', type: 'numeric', isNullable: true },
        { name: 'subscribers', type: 'numeric', isNullable: true },
github smartcontractkit / chainlink / explorer / src / migration / 1565028153000-AddAdmin.ts View on Github external
public async up(queryRunner: QueryRunner): Promise {
    const options = {
      name: TABLE_NAME,
      columns: [
        idColumm,
        usernameColumn,
        hashedPasswordColumn,
        createdAtColumn,
        updatedAtColumn,
      ],
    }

    await queryRunner.createTable(new Table(options))
  }