Skip to content

Commit

Permalink
Merge pull request #1 from typeorm/master
Browse files Browse the repository at this point in the history
Rebase
  • Loading branch information
dcworldwide committed Jan 15, 2017
2 parents cfdb615 + af777d7 commit 9720d49
Show file tree
Hide file tree
Showing 289 changed files with 2,415 additions and 765 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
@@ -1,6 +1,15 @@
# 0.0.7 (upcoming)

* fixed bug when new column was'nt added properly in sqlite #157
* fixed bug when new column was'nt added properly in sqlite [#157](https://github.com/typeorm/typeorm/issues/157)
* added ability to set different types of values for DEFAULT value of the column [#150](https://github.com/typeorm/typeorm/issues/150)
* all table decorators are renamed to `Entity` (`Table` => `Entity`, `AbstractTable` => `AbstractEntity`,
`ClassTableChild` => `ClassEntityChild`, `ClosureTable` => `ClosureEntity`, `EmbeddableTable` => `EmbeddableEntity`,
`SingleTableChild` => `SingleEntityChild`). This change is required because upcoming versions of orm will work
not only with tables, but also with documents and other database-specific "tables".
Previous decorator names are deprecated and will be removed in the future.
* added custom repositories support. Example in samples directory.
* cascade remove options has been removed from `@ManyToMany`, `@OneToMany` decorators. Also cascade remove is not possible
from two sides of `@OneToOne` relationship now.

# 0.0.6 (latest)

Expand Down
52 changes: 45 additions & 7 deletions extra/browser-shim.js
Expand Up @@ -145,7 +145,51 @@ exports.RelationCount = RelationCount;
}
exports.RelationId = RelationId;

// tables
// entities

/* export */ function AbstractEntity() {
return function (object) {
};
}
exports.AbstractEntity = AbstractEntity;

/* export */ function ClassEntityChild(tableName, options) {
return function (object) {
};
}
exports.ClassEntityChild = ClassEntityChild;

/* export */ function ClosureEntity(name, options) {
return function (object) {
};
}
exports.ClosureEntity = ClosureEntity;

/* export */ function EmbeddableEntity() {
return function (object) {
};
}
exports.EmbeddableEntity = EmbeddableEntity;

/* export */ function SingleEntityChild() {
return function (object) {
};
}
exports.SingleEntityChild = SingleEntityChild;

/* export */ function Entity(name, options) {
return function (object) {
};
}
exports.Entity = Entity;

/* export */ function TableInheritance(type) {
return function (object) {
};
}
exports.TableInheritance = TableInheritance;

// tables (deprecated)

/* export */ function AbstractTable() {
return function (object) {
Expand Down Expand Up @@ -183,12 +227,6 @@ exports.SingleTableChild = SingleTableChild;
}
exports.Table = Table;

/* export */ function TableInheritance(type) {
return function (object) {
};
}
exports.TableInheritance = TableInheritance;

// tree

/* export */ function TreeChildren(options) {
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.ts
Expand Up @@ -327,7 +327,7 @@ export class Gulpfile {

return gulp.src(["./build/compiled/test/**/*.js"])
.pipe(mocha({
timeout: 10000
timeout: 15000
}))
.pipe(istanbul.writeReports());
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "typeorm",
"private": true,
"version": "0.0.7-alpha.8",
"version": "0.0.7-alpha.19",
"description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases.",
"license": "MIT",
"readmeFilename": "README.md",
Expand Down
15 changes: 0 additions & 15 deletions sample/sample1-simple-entity/app.ts
Expand Up @@ -32,21 +32,6 @@ const options: ConnectionOptions = {
autoSchemaSync: true,
entities: [Post]
};
/*const options: CreateConnectionOptions = {
driver: "postgres",
driverOptions: {
host: "localhost",
port: 5432,
username: "test",
password: "admin",
database: "test",
autoSchemaSync: true,
logging: {
logQueries: true
}
},
entities: [Post]
};*/

createConnection(options).then(connection => {

Expand Down
5 changes: 3 additions & 2 deletions sample/sample1-simple-entity/entity/Post.ts
@@ -1,7 +1,8 @@
import {Column, Table} from "../../../src/index";
import {Column, Entity} from "../../../src/index";
import {PrimaryColumn} from "../../../src/decorator/columns/PrimaryColumn";
import {Index} from "../../../src/decorator/Index";

@Table("sample01_post")
@Entity("sample01_post")
export class Post {

@PrimaryColumn("int", { generated: true })
Expand Down
4 changes: 2 additions & 2 deletions sample/sample10-mixed/entity/Category.ts
@@ -1,8 +1,8 @@
import {PrimaryGeneratedColumn, Column, Table, ManyToOne, ManyToMany} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity, ManyToOne, ManyToMany} from "../../../src/index";
import {Post} from "./Post";
import {PostDetails} from "./PostDetails";

@Table("sample10_category")
@Entity("sample10_category")
export class Category {

@PrimaryGeneratedColumn()
Expand Down
4 changes: 2 additions & 2 deletions sample/sample10-mixed/entity/Chapter.ts
@@ -1,7 +1,7 @@
import {PrimaryGeneratedColumn, Column, Table, OneToMany} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity, OneToMany} from "../../../src/index";
import {PostDetails} from "./PostDetails";

@Table("sample10_chapter")
@Entity("sample10_chapter")
export class Chapter {

@PrimaryGeneratedColumn()
Expand Down
4 changes: 2 additions & 2 deletions sample/sample10-mixed/entity/Cover.ts
@@ -1,7 +1,7 @@
import {PrimaryGeneratedColumn, Column, Table, OneToMany} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity, OneToMany} from "../../../src/index";
import {Post} from "./Post";

@Table("sample10_cover")
@Entity("sample10_cover")
export class Cover {

@PrimaryGeneratedColumn()
Expand Down
4 changes: 2 additions & 2 deletions sample/sample10-mixed/entity/Image.ts
@@ -1,9 +1,9 @@
import {PrimaryGeneratedColumn, Column, Table, ManyToOne, OneToOne} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity, ManyToOne, OneToOne} from "../../../src/index";
import {Post} from "./Post";
import {ImageDetails} from "./ImageDetails";
import {JoinColumn} from "../../../src/decorator/relations/JoinColumn";

@Table("sample10_image")
@Entity("sample10_image")
export class Image {

@PrimaryGeneratedColumn()
Expand Down
4 changes: 2 additions & 2 deletions sample/sample10-mixed/entity/ImageDetails.ts
@@ -1,7 +1,7 @@
import {PrimaryGeneratedColumn, Column, Table, OneToOne} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity, OneToOne} from "../../../src/index";
import {Image} from "./Image";

@Table("sample10_image_details")
@Entity("sample10_image_details")
export class ImageDetails {

@PrimaryGeneratedColumn()
Expand Down
10 changes: 4 additions & 6 deletions sample/sample10-mixed/entity/Post.ts
@@ -1,12 +1,12 @@
import {PrimaryGeneratedColumn, Column, Table, OneToMany, ManyToOne, ManyToMany, OneToOne} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity, OneToMany, ManyToOne, ManyToMany, OneToOne} from "../../../src/index";
import {Image} from "./Image";
import {Cover} from "./Cover";
import {Category} from "./Category";
import {PostDetails} from "./PostDetails";
import {JoinColumn} from "../../../src/decorator/relations/JoinColumn";
import {JoinTable} from "../../../src/decorator/relations/JoinTable";

@Table("sample10_post")
@Entity("sample10_post")
export class Post {

@PrimaryGeneratedColumn()
Expand All @@ -32,8 +32,7 @@ export class Post {

@OneToMany(type => Image, image => image.post, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true
cascadeUpdate: true
})
images: Image[] = [];

Expand All @@ -54,8 +53,7 @@ export class Post {

@ManyToMany(type => Category, category => category.posts, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true
cascadeUpdate: true
})
@JoinTable()
categories: Category[];
Expand Down
7 changes: 3 additions & 4 deletions sample/sample10-mixed/entity/PostDetails.ts
@@ -1,9 +1,9 @@
import {PrimaryGeneratedColumn, Column, Table, OneToOne, OneToMany, ManyToOne} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity, OneToOne, OneToMany, ManyToOne} from "../../../src/index";
import {Post} from "./Post";
import {Chapter} from "./Chapter";
import {Category} from "./Category";

@Table("sample10_post_details")
@Entity("sample10_post_details")
export class PostDetails {

@PrimaryGeneratedColumn()
Expand All @@ -19,8 +19,7 @@ export class PostDetails {
post: Post;

@OneToMany(type => Category, category => category.details, {
cascadeInsert: true,
cascadeRemove: true
cascadeInsert: true
})
categories: Category[];

Expand Down
4 changes: 2 additions & 2 deletions sample/sample11-all-types-entity/entity/EverythingEntity.ts
@@ -1,8 +1,8 @@
import {PrimaryGeneratedColumn, Column, Table} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity} from "../../../src/index";
import {CreateDateColumn} from "../../../src/decorator/columns/CreateDateColumn";
import {UpdateDateColumn} from "../../../src/decorator/columns/UpdateDateColumn";

@Table("sample11_everything_entity")
@Entity("sample11_everything_entity")
export class EverythingEntity {

@PrimaryGeneratedColumn()
Expand Down
4 changes: 2 additions & 2 deletions sample/sample12-custom-naming-strategy/entity/Post.ts
@@ -1,6 +1,6 @@
import {PrimaryGeneratedColumn, Column, Table} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity} from "../../../src/index";

@Table("sample1_post")
@Entity("sample1_post")
export class Post {

@PrimaryGeneratedColumn()
Expand Down
4 changes: 2 additions & 2 deletions sample/sample13-everywhere-abstraction/entity/BaseObject.ts
@@ -1,11 +1,11 @@
import {Column} from "../../../src/index";
import {AbstractTable} from "../../../src/decorator/tables/AbstractTable";
import {AbstractEntity} from "../../../src/decorator/entity/AbstractEntity";
import {BasePost} from "./BasePost";
import {PostAuthor} from "./PostAuthor";
import {ManyToOne} from "../../../src/decorator/relations/ManyToOne";
import {PrimaryColumn} from "../../../src/decorator/columns/PrimaryColumn";

@AbstractTable()
@AbstractEntity()
export class BaseObject extends BasePost {

@PrimaryColumn("double", { generated: true })
Expand Down
4 changes: 2 additions & 2 deletions sample/sample13-everywhere-abstraction/entity/BasePost.ts
@@ -1,7 +1,7 @@
import {PrimaryGeneratedColumn, Column} from "../../../src/index";
import {AbstractTable} from "../../../src/decorator/tables/AbstractTable";
import {AbstractEntity} from "../../../src/decorator/entity/AbstractEntity";

@AbstractTable()
@AbstractEntity()
export class BasePost {

@PrimaryGeneratedColumn()
Expand Down
7 changes: 3 additions & 4 deletions sample/sample13-everywhere-abstraction/entity/Blog.ts
@@ -1,19 +1,18 @@
import {Column, Table} from "../../../src/index";
import {Column, Entity} from "../../../src/index";
import {ManyToMany} from "../../../src/decorator/relations/ManyToMany";
import {PostCategory} from "./PostCategory";
import {JoinTable} from "../../../src/decorator/relations/JoinTable";
import {BaseObject} from "./BaseObject";

@Table("sample13_blog")
@Entity("sample13_blog")
export class Blog extends BaseObject {

@Column()
text: string;

@ManyToMany(type => PostCategory, category => category.posts, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true
cascadeUpdate: true
})
@JoinTable()
categories: PostCategory[] = [];
Expand Down
7 changes: 3 additions & 4 deletions sample/sample13-everywhere-abstraction/entity/Post.ts
@@ -1,19 +1,18 @@
import {Column, Table} from "../../../src/index";
import {Column, Entity} from "../../../src/index";
import {PostCategory} from "./PostCategory";
import {ManyToMany} from "../../../src/decorator/relations/ManyToMany";
import {JoinTable} from "../../../src/decorator/relations/JoinTable";
import {BaseObject} from "./BaseObject";

@Table("sample13_post")
@Entity("sample13_post")
export class Post extends BaseObject {

@Column()
text: string;

@ManyToMany(type => PostCategory, category => category.posts, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true
cascadeUpdate: true
})
@JoinTable()
categories: PostCategory[] = [];
Expand Down
4 changes: 2 additions & 2 deletions sample/sample13-everywhere-abstraction/entity/PostAuthor.ts
@@ -1,9 +1,9 @@
import {PrimaryGeneratedColumn, Column, Table} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity} from "../../../src/index";
import {Post} from "./Post";
import {OneToMany} from "../../../src/decorator/relations/OneToMany";
import {PostUser} from "./PostUser";

@Table("sample13_post_author")
@Entity("sample13_post_author")
export class PostAuthor extends PostUser {

@PrimaryGeneratedColumn()
Expand Down
7 changes: 3 additions & 4 deletions sample/sample13-everywhere-abstraction/entity/PostCategory.ts
@@ -1,8 +1,8 @@
import {PrimaryGeneratedColumn, Column, Table} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity} from "../../../src/index";
import {Post} from "./Post";
import {ManyToMany} from "../../../src/decorator/relations/ManyToMany";

@Table("sample13_post_category")
@Entity("sample13_post_category")
export class PostCategory {

@PrimaryGeneratedColumn()
Expand All @@ -13,8 +13,7 @@ export class PostCategory {

@ManyToMany(type => Post, post => post.categories, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true
cascadeUpdate: true
})
posts: Post[] = [];

Expand Down
4 changes: 2 additions & 2 deletions sample/sample13-everywhere-abstraction/entity/PostUser.ts
@@ -1,6 +1,6 @@
import {PrimaryGeneratedColumn, Column, Table} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity} from "../../../src/index";

@Table("sample13_post_user")
@Entity("sample13_post_user")
export class PostUser {

@PrimaryGeneratedColumn()
Expand Down
7 changes: 3 additions & 4 deletions sample/sample14-errors-in-wrong-metdata/entity/Post.ts
@@ -1,11 +1,11 @@
import {PrimaryGeneratedColumn, Column, Table, OneToOne} from "../../../src/index";
import {PrimaryGeneratedColumn, Column, Entity, OneToOne} from "../../../src/index";
import {PostAuthor} from "./PostAuthor";
import {JoinColumn} from "../../../src/decorator/relations/JoinColumn";
import {OneToMany} from "../../../src/decorator/relations/OneToMany";
import {JoinTable} from "../../../src/decorator/relations/JoinTable";
import {ManyToMany} from "../../../src/decorator/relations/ManyToMany";

@Table("sample14_post")
@Entity("sample14_post")
export class Post {

@PrimaryGeneratedColumn()
Expand All @@ -28,8 +28,7 @@ export class Post {

@OneToMany(type => PostAuthor, author => author.editedPost, {
cascadeInsert: true,
cascadeUpdate: true,
cascadeRemove: true
cascadeUpdate: true
})
// @JoinColumn() // uncomment this and you'll get an error, because JoinColumn is not allowed here (only many-to-one/one-to-one)
// @JoinTable() // uncomment this and you'll get an error because JoinTable is not allowed here (only many-to-many)
Expand Down

0 comments on commit 9720d49

Please sign in to comment.