hhtokpinar / sqfEntity

SqfEntity ORM for Flutter/Dart lets you build and execute SQL commands on SQLite database easily and quickly with the help of fluent methods similar to .Net Entity Framework. SqfEntity also generates add/edit forms with validations and special controls (DropDown List, DateTime pickers, Checkboxes.. etc) for your table.
378 stars 99 forks source link

is grouped unique supported? #128

Closed bongjinpark1 closed 4 years ago

bongjinpark1 commented 4 years ago
const tableSecond = SqfEntityTable(
    tableName: 'second',
    primaryKeyName: 'id',
    primaryKeyType: PrimaryKeyType.integer_auto_incremental,
    fields: [
      SqfEntityField('time', DbType.datetime, isUnique: true, isIndex: true),
      SqfEntityField('deviceId', DbType.text, isUnique: true, isIndex: true),
      ...some other fields
    ]);

When I save new data with same deviceId but different time can not saved (older one is alived, new one not be saved.).

Is there any way define grouped unique fields?

Thanks.

hhtokpinar commented 4 years ago

Yes of course, Have you tried isPrimarykey parameter to make grouped unique fields?

bongjinpark1 commented 4 years ago

Yes of course, Have you tried isPrimarykey parameter to make grouped unique fields?

You saved my life. Thanks!

hhtokpinar commented 4 years ago

You’re welcome.

Regards...