Skip to content

Instantly share code, notes, and snippets.

@SamuelMarks SamuelMarks/example.ts
Last active Nov 23, 2017

What would you like to do?
import 'reflect-metadata';
import { createConnection } from 'typeorm';
export class User {
@PrimaryColumn({ type: 'varchar' })
public username: string;
@Column({ type: 'varchar', nullable: false, select: false })
public password: string;
type: "mysql",
host: "localhost",
port: 3306,
username: "root",
password: "admin",
database: "test",
entities: [ User ],
synchronize: true,
logging: false
}).then(connection => {
const user0 = new User();
user0.username = 'foo';
user0.password = Math.random().toString();
.then(() => {
const user1 = new User();
user1.username = 'foo';
user1.password = Math.random().toString();
.then(() =>'inserted:', user1, 'over', user0, ';'))
}).catch(error => console.log(error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.