类型0.2.8
我正在构建一个适用于移动使用和浏览器 (PWA) 使用的 Ionic 应用程序。下面是我的项目中的一些简短代码。我使用 a 创建一个简单的实体PrimaryGeneratedColumn并尝试插入一个实例。这会生成有关主列为 的错误NULL。“生成”这个词不是意味着生成列值吗?
这是一个错误吗?司机有什么具体的事情sqljs吗?或者我错过了一些明显而简单的事情?
@Entity()
export class MyEntity {
@PrimaryGeneratedColumn()
id:number;
@Column()
name:string;
@CreateDateColumn()
createdAt:string;
}
Run Code Online (Sandbox Code Playgroud)
export class Migration20181022133900 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.createTable(new Table({
name: 'my_entity',
columns: [
{
name: 'id',
type: 'int',
isPrimary: true,
isGenerated: true
},
{
name: 'name',
type: 'varchar'
},
{
name: 'createdAt',
type: 'timestamp',
'default': 'now()'
}
]
}), true);
}
async down(queryRunner: QueryRunner): Promise<any> …Run Code Online (Sandbox Code Playgroud)