项目作者: FujiBilly

项目描述 :
拓展sequelize-typescript库支持分区表
高级语言: TypeScript
项目地址: git://github.com/FujiBilly/partition-sequelize-ts.git
创建时间: 2019-09-17T02:47:03Z
项目社区:https://github.com/FujiBilly/partition-sequelize-ts

开源协议:

下载


partition-sequelize-ts

改进 sequelize-typescript 库使其支持 Postgresql 10/11版本的分区表

使用示例:

  1. import {
  2. Model,
  3. Table,
  4. Column,
  5. PrimaryKey,
  6. Comment,
  7. DataType,
  8. AllowNull,
  9. Default
  10. } from 'partition-sequelize-ts';
  11. @Table({
  12. tableName: 'partition_model',
  13. partition: 'RANGE',
  14. partitionKey: 'id',
  15. partitionRule: {
  16. 0: [1, 10000000],
  17. 1: [10000001, 20000000]
  18. }
  19. })
  20. export default class PartitionModel extends Model<PartitionModel> {
  21. @Comment('id')
  22. @PrimaryKey
  23. @Column(DataType.INTEGER)
  24. id: number;
  25. @Comment('企业id')
  26. @AllowNull(false)
  27. @Default('')
  28. @Column(DataType.TEXT)
  29. options: string;
  30. }