mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
added test for #1388
This commit is contained in:
parent
3e8ae180d5
commit
c47cf7ecbd
@ -1,6 +1,18 @@
|
||||
version: '3'
|
||||
services:
|
||||
|
||||
# mysql-5.5
|
||||
#mysql5.5:
|
||||
# image: "mysql:5.5"
|
||||
# container_name: "typeorm-mysql-5.5"
|
||||
# ports:
|
||||
# - "3306:3306"
|
||||
# environment:
|
||||
# MYSQL_ROOT_PASSWORD: "admin"
|
||||
# MYSQL_USER: "test"
|
||||
# MYSQL_PASSWORD: "test"
|
||||
# MYSQL_DATABASE: "test"
|
||||
|
||||
# mysql
|
||||
mysql:
|
||||
image: "mysql:5.7.10"
|
||||
|
||||
12
test/github-issues/1388/entity/Post.ts
Normal file
12
test/github-issues/1388/entity/Post.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import {Column, Entity, PrimaryGeneratedColumn} from "../../../../src";
|
||||
|
||||
@Entity()
|
||||
export class Post {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column({ type: "timestamp", nullable: true })
|
||||
createdAt: Date;
|
||||
|
||||
}
|
||||
25
test/github-issues/1388/issue-1388.ts
Normal file
25
test/github-issues/1388/issue-1388.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import "reflect-metadata";
|
||||
import {Connection} from "../../../src/connection/Connection";
|
||||
import {closeTestingConnections, createTestingConnections} from "../../utils/test-utils";
|
||||
|
||||
describe("github issues > #1388 nullable: true dons't output 'NULL' in mysql", () => {
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => {
|
||||
connections = await createTestingConnections({
|
||||
entities: [__dirname + "/entity/*{.js,.ts}"],
|
||||
enabledDrivers: ["mysql"],
|
||||
schemaCreate: true,
|
||||
dropSchema: true,
|
||||
});
|
||||
});
|
||||
after(() => closeTestingConnections(connections));
|
||||
|
||||
it("should correctly create nullable column", () => Promise.all(connections.map(async connection => {
|
||||
const queryRunner = connection.createQueryRunner();
|
||||
const table = await queryRunner.getTable("post");
|
||||
table!.findColumnByName("createdAt")!.isNullable.should.be.true;
|
||||
await queryRunner.release();
|
||||
})));
|
||||
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user