@entity-access/entity-access 1.0.122 → 1.0.123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/decorators/Column.d.ts +6 -1
  2. package/dist/decorators/Column.d.ts.map +1 -1
  3. package/dist/decorators/Column.js +7 -0
  4. package/dist/decorators/Column.js.map +1 -1
  5. package/dist/decorators/IColumn.d.ts +3 -1
  6. package/dist/decorators/IColumn.d.ts.map +1 -1
  7. package/dist/drivers/base/BaseDriver.js +1 -1
  8. package/dist/drivers/base/BaseDriver.js.map +1 -1
  9. package/dist/migrations/Migrations.d.ts.map +1 -1
  10. package/dist/migrations/Migrations.js +9 -0
  11. package/dist/migrations/Migrations.js.map +1 -1
  12. package/dist/migrations/postgres/PostgresAutomaticMigrations.d.ts.map +1 -1
  13. package/dist/migrations/postgres/PostgresAutomaticMigrations.js +13 -3
  14. package/dist/migrations/postgres/PostgresAutomaticMigrations.js.map +1 -1
  15. package/dist/migrations/sql-server/SqlServerAutomaticMigrations.d.ts.map +1 -1
  16. package/dist/migrations/sql-server/SqlServerAutomaticMigrations.js +14 -2
  17. package/dist/migrations/sql-server/SqlServerAutomaticMigrations.js.map +1 -1
  18. package/dist/model/changes/ChangeEntry.js +1 -1
  19. package/dist/model/changes/ChangeEntry.js.map +1 -1
  20. package/dist/query/ast/ExpressionToSql.js +1 -1
  21. package/dist/query/ast/ExpressionToSql.js.map +1 -1
  22. package/dist/tests/model/ShoppingContext.d.ts +1 -0
  23. package/dist/tests/model/ShoppingContext.d.ts.map +1 -1
  24. package/dist/tests/model/ShoppingContext.js +13 -7
  25. package/dist/tests/model/ShoppingContext.js.map +1 -1
  26. package/dist/tests/model/UseFile.js +1 -1
  27. package/dist/tests/model/UseFile.js.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +1 -1
  30. package/src/decorators/Column.ts +13 -3
  31. package/src/decorators/IColumn.ts +5 -1
  32. package/src/drivers/base/BaseDriver.ts +1 -1
  33. package/src/migrations/Migrations.ts +11 -0
  34. package/src/migrations/postgres/PostgresAutomaticMigrations.ts +17 -3
  35. package/src/migrations/sql-server/SqlServerAutomaticMigrations.ts +16 -2
  36. package/src/model/changes/ChangeEntry.ts +1 -1
  37. package/src/query/ast/ExpressionToSql.ts +1 -1
  38. package/src/tests/model/ShoppingContext.ts +12 -7
  39. package/src/tests/model/UseFile.ts +1 -1
@@ -5,6 +5,7 @@ import Table from "../../decorators/Table.js";
5
5
  import Index from "../../decorators/Index.js";
6
6
  import DateTime from "../../types/DateTime.js";
7
7
  import { UserFile } from "./UseFile.js";
8
+ import Sql from "../../sql/Sql.js";
8
9
 
9
10
  export const statusPublished = "published";
10
11
 
@@ -41,7 +42,7 @@ export class ShoppingContext extends EntityContext {
41
42
  })
42
43
  export class User {
43
44
 
44
- @Column({ key: true , autoGenerate: true, dataType: "BigInt" })
45
+ @Column({ key: true , generated: "identity", dataType: "BigInt" })
45
46
  public userID: number;
46
47
 
47
48
  @Column({})
@@ -80,6 +81,10 @@ export class Category {
80
81
  @Column({ length: 200 })
81
82
  public name: string;
82
83
 
84
+
85
+ @Column({ computed: (x) => Sql.text.lower(x.name)})
86
+ public lowerName: string;
87
+
83
88
  @Column({ dataType: "Char", length: 200, nullable: true })
84
89
  @RelateTo(Category, {
85
90
  property: (c) => c.parent,
@@ -118,7 +123,7 @@ export class UserProfile {
118
123
  @Table("ProfilePhotos")
119
124
  export class ProfilePhoto {
120
125
 
121
- @Column({ key: true, dataType: "BigInt", autoGenerate: true })
126
+ @Column({ key: true, dataType: "BigInt", generated: "identity" })
122
127
  public photoID: number;
123
128
 
124
129
  @Column ({ dataType: "BigInt"})
@@ -162,7 +167,7 @@ export class UserCategory {
162
167
  @Table("Products")
163
168
  export class Product {
164
169
 
165
- @Column({ key: true, autoGenerate: true, dataType: "BigInt" })
170
+ @Column({ key: true, generated: "identity", dataType: "BigInt" })
166
171
  public productID: number;
167
172
 
168
173
  @Column()
@@ -189,7 +194,7 @@ export class Product {
189
194
  @Table("ProductCategories")
190
195
  export class ProductCategory {
191
196
 
192
- @Column({ key: true, dataType: "BigInt", autoGenerate: true })
197
+ @Column({ key: true, dataType: "BigInt", generated: "identity" })
193
198
  public productCategoryID: number;
194
199
 
195
200
  @Column({ dataType: "BigInt" })
@@ -214,7 +219,7 @@ export class ProductCategory {
214
219
  @Table("ProductPrices")
215
220
  export class ProductPrice {
216
221
 
217
- @Column({ key: true, autoGenerate: true, dataType: "BigInt"})
222
+ @Column({ key: true, generated: "identity", dataType: "BigInt"})
218
223
  public priceID: number;
219
224
 
220
225
  @Column()
@@ -248,7 +253,7 @@ export class ProductPrice {
248
253
  })
249
254
  export class Order {
250
255
 
251
- @Column({ key: true, autoGenerate: true, dataType: "BigInt"})
256
+ @Column({ key: true, generated: "identity", dataType: "BigInt"})
252
257
  public orderID: number;
253
258
 
254
259
  @Column()
@@ -273,7 +278,7 @@ export class Order {
273
278
  @Table("OrderItems")
274
279
  export class OrderItem {
275
280
 
276
- @Column({ key: true, autoGenerate: true, dataType: "BigInt"})
281
+ @Column({ key: true, generated: "identity", dataType: "BigInt"})
277
282
  public orderItemID: number;
278
283
 
279
284
  @Column()
@@ -6,7 +6,7 @@ import { User } from "./ShoppingContext.js";
6
6
  @Table("UserFiles")
7
7
  export class UserFile {
8
8
 
9
- @Column({ dataType: "BigInt", key: true, autoGenerate: true })
9
+ @Column({ dataType: "BigInt", key: true, generated: "identity" })
10
10
  public fileID: number;
11
11
 
12
12
  @Column({ dataType: "BigInt"})