added primary decorator for the future

This commit is contained in:
Umed Khudoiberdiev 2016-08-27 00:50:33 +05:00
parent a44ccb6bbb
commit 6eb1cab7db
2 changed files with 20 additions and 0 deletions

View File

@ -2,6 +2,8 @@ import {getMetadataArgsStorage} from "../../index";
import {CompositeIndexOptions} from "../options/CompositeIndexOptions";
import {IndexMetadataArgs} from "../../metadata-args/IndexMetadataArgs";
// todo: maybe merge this with Index decorator?
/**
* Composite index must be set on entity classes and must specify entity's fields to be indexed.
*/

View File

@ -0,0 +1,18 @@
// todo: create @Primary() that can also be simple and composite. multiple usages of @Primary means multiple keys should be used
// todo: maybe also need to support using @Primary on classes
// todo: @Primary() can be used with @Column, it will give same result as @PrimaryColumn
// todo: also @Primary can be used on relations (manyToOne and oneToOne)
// todo: it should be possible to make combinations of primary keys on columns and relational columns
// todo: primary keys should be used on junction tables
export function Primary() {
return function (object: Object, propertyName: string) {
/*const args: IndexMetadataArgs = {
name: name,
target: object.constructor,
columns: [propertyName],
unique: options && options.unique ? true : false
};
getMetadataArgsStorage().indices.add(args);*/
};
}