How to use the typeorm.TableColumn 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 Xetera / HifumiOld / src / database / migrations / 1525024992361-persistentMutes.ts View on Github external
name: 'guild_id',
                type: 'varchar'
            }), new TableColumn({
                name: 'start_date',
                type: 'date'
            }), new TableColumn({
                name: 'end_date',
                type: 'date'
            })]
        }));
        await queryRunner.createForeignKey('muted_users', new TableForeignKey({
            columnNames: ['guild_id'],
            referencedTableName: 'guilds',
            referencedColumnNames: ['id']
        }));
        await queryRunner.addColumn('users', new TableColumn({
            name: 'history_calls',
            type: 'integer',
            default: 0
        }));
        await queryRunner.addColumn('users', new TableColumn({
            name: 'enabled',
            type: 'boolean',
            default: true
        }));
        await queryRunner.changeColumn('guilds', 'allows_invites', new TableColumn({
            name: 'allows_invites',
            type: 'boolean',
            default: true
        }))
    }
github smartcontractkit / chainlink / explorer / src / migration / 1565028153000-AddAdmin.ts View on Github external
const idColumm = new TableColumn({
  name: 'id',
  type: 'character varying',
  isPrimary: true,
  isNullable: false,
  default: 'uuid_generate_v4()',
})

const usernameColumn = new TableColumn({
  name: 'username',
  type: 'character varying',
  isUnique: true,
  isNullable: false,
})

const hashedPasswordColumn = new TableColumn({
  name: 'hashedPassword',
  type: 'character varying',
  isNullable: false,
})

const createdAtColumn = new TableColumn({
  name: 'createdAt',
  type: 'timestamp without time zone',
  isNullable: true,
  default: 'now()',
})

const updatedAtColumn = new TableColumn({
  name: 'updatedAt',
  type: 'timestamp without time zone',
  isNullable: true,
github smartcontractkit / chainlink / explorer / src / migration / 1555449849759-AlterInitiatorRequestColsToNullable.ts View on Github external
public async down(queryRunner: QueryRunner): Promise {
    await queryRunner.changeColumns('initiator', [
      {
        oldColumn: new TableColumn({
          name: 'requestId',
          type: 'varchar',
          isNullable: true
        }),
        newColumn: new TableColumn({
          name: 'requestId',
          type: 'varchar',
          isNullable: false
        })
      },
      {
        oldColumn: new TableColumn({
          name: 'txHash',
          type: 'varchar',
          isNullable: true
        }),
        newColumn: new TableColumn({
          name: 'txHash',
          type: 'varchar',
          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
                }),new TableColumn({
                    name: 'strike_count',
                    type: 'integer',
                    default: 0
                }),new TableColumn({
                    name: 'ignoring',
                    type: 'boolean',
                    default: false
                })
            ],
            foreignKeys: [new TableForeignKey({
                referencedTableName: 'guilds',
                referencedColumnNames: ['id'],
github smartcontractkit / chainlink / explorer / src / migration / 1567456981385-AddTimestampBlockHeightBlockHashToTaskRun.ts View on Github external
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'

const TABLE_NAME = 'task_run'

const timestampColumm = new TableColumn({
  name: 'timestamp',
  isNullable: true,
  type: 'timestamp without time zone',
})

const blockHeightColumn = new TableColumn({
  name: 'blockHeight',
  isNullable: true,
  type: 'bigint',
})

const blockHashColumn = new TableColumn({
  name: 'blockHash',
  isNullable: true,
  type: 'character varying',
})
github rucken / core-nestjs / libs / rucken / core-nestjs / src / migrations / 1524197725191-Init.ts View on Github external
isNullable: false,
            default: queryRunner.connection.driver.mappedDataTypes.createDateDefault
          },
          {
            name: 'date_of_birth',
            type: queryRunner.connection.driver.mappedDataTypes.createDate.toString(),
            isNullable: true
          }
        ]
      }),
      true
    );
    await queryRunner.changeColumn(
      'users',
      'id',
      new TableColumn({
        name: 'id',
        type: 'integer',
        isPrimary: true,
        isGenerated: true,
        generationStrategy: 'increment'
      })
    );
    if (!(queryRunner.connection.driver as any).sqlite) {
      await queryRunner.createIndex(
        'users',
        new TableIndex({
          name: 'IDX_USE_E',
          columnNames: ['email']
        })
      );
      await queryRunner.createIndex(
github smartcontractkit / chainlink / explorer / src / migration / 1555449849759-AlterInitiatorRequestColsToNullable.ts View on Github external
})
      },
      {
        oldColumn: new TableColumn({
          name: 'txHash',
          type: 'varchar',
          isNullable: true
        }),
        newColumn: new TableColumn({
          name: 'txHash',
          type: 'varchar',
          isNullable: false
        })
      },
      {
        oldColumn: new TableColumn({
          name: 'requester',
          type: 'varchar',
          isNullable: true
        }),
        newColumn: new TableColumn({
          name: 'requester',
          type: 'varchar',
          isNullable: false
        })
      }
    ])
  }
}
github smartcontractkit / chainlink / explorer / src / migration / 1565028153000-AddAdmin.ts View on Github external
})

const usernameColumn = new TableColumn({
  name: 'username',
  type: 'character varying',
  isUnique: true,
  isNullable: false,
})

const hashedPasswordColumn = new TableColumn({
  name: 'hashedPassword',
  type: 'character varying',
  isNullable: false,
})

const createdAtColumn = new TableColumn({
  name: 'createdAt',
  type: 'timestamp without time zone',
  isNullable: true,
  default: 'now()',
})

const updatedAtColumn = new TableColumn({
  name: 'updatedAt',
  type: 'timestamp without time zone',
  isNullable: true,
  default: 'now()',
})

export class AddAdmin1565028153000 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise {
    const options = {
github smartcontractkit / chainlink / explorer / src / migration / 1565028153000-AddAdmin.ts View on Github external
import { MigrationInterface, QueryRunner, Table, TableColumn } from 'typeorm'

const TABLE_NAME = 'admin'

const idColumm = new TableColumn({
  name: 'id',
  type: 'character varying',
  isPrimary: true,
  isNullable: false,
  default: 'uuid_generate_v4()',
})

const usernameColumn = new TableColumn({
  name: 'username',
  type: 'character varying',
  isUnique: true,
  isNullable: false,
})

const hashedPasswordColumn = new TableColumn({
  name: 'hashedPassword',
github smartcontractkit / chainlink / explorer / src / migration / 1555455668001-InitiatorDropCreatedAt.ts View on Github external
public async down(queryRunner: QueryRunner): Promise {
    await queryRunner.addColumn(
      'initiator',
      new TableColumn({
        name: 'createdAt',
        type: 'timestamp'
      })
    )
  }
}