Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}))
}
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,
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
})
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'],
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',
})
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(
})
},
{
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
})
}
])
}
}
})
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 = {
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',
public async down(queryRunner: QueryRunner): Promise {
await queryRunner.addColumn(
'initiator',
new TableColumn({
name: 'createdAt',
type: 'timestamp'
})
)
}
}