mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
added primary decorator for the future
This commit is contained in:
parent
a44ccb6bbb
commit
6eb1cab7db
@ -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.
|
||||
*/
|
||||
|
||||
18
src/decorator/indices/Primary.ts
Normal file
18
src/decorator/indices/Primary.ts
Normal 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);*/
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user