liulipeng

Unique constraint on single String column with GreenDao

转:http://stackoverflow.com/questions/22070281/greendao-support-for-unique-constraint-on-multiple-columns

Does GreenDao supports unique constraint on multiple columns? Equivalent of the following:

create table projects (
  _id integer primary key autoincrement,
  project_type text,
  name text,
  unique (project_type, name)
);


Yes, it supports.

Create an index with all the properties and make it unique.

Index indexUnique = new Index();
indexUnique.addProperty(project_type);
indexUnique.addProperty(name);
indexUnique.makeUnique();
projectsEntity.addIndex(indexUnique);

分类:

技术点:

相关文章:

  • 2021-11-17
  • 2022-02-25
  • 2021-11-19
  • 2022-01-17
  • 2022-01-11
  • 2021-11-18
  • 2021-09-27
猜你喜欢
  • 2021-09-11
  • 2021-12-06
  • 2021-09-12
  • 2021-11-19
  • 2021-11-02
  • 2021-10-16
相关资源
相似解决方案