Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1.0 #1416

Merged
merged 45 commits into from
Aug 27, 2017
Merged

4.1.0 #1416

merged 45 commits into from
Aug 27, 2017

Conversation

agrosner
Copy link
Owner

@agrosner agrosner commented Aug 27, 2017

  1. @ModelView are now created after migrations are run so latest DB data is respected.
  2. New annotation @ColumnMap! It enables embedding other object's exposed properties into the current table as @Column so that object hierarchy is respected without excessive DB complication.
class Location(var latitude: Double = 0.0, var longitude: Double = 0.0)

@Table(database = TestDatabase::class)
class Position(@PrimaryKey var id: Int = 0, @ColumnMap var location: Location? = null)

creates a table with the following columns:

  public static final Property<Integer> id = new Property<Integer>(Position.class, "id");
  public static final Property<Double> latitude = new Property<Double>(Position.class, "latitude");
  public static final Property<Double> longitude = new Property<Double>(Position.class, "longitude");
  1. @database(name = , extension = ) are deprecated. Specify the name now in the DatabaseConfig.databaseName() when FlowManager is initialized. This means that DBFlow supports dynamic database names and instances.
FlowManager.init(FlowConfig.builder()
    .addDatabaseConfig(DatabaseConfig.builder(AppDatabase.class)
      .databaseName("AppDatabase")
      .databaseExtension(".txt")
      .build())
    .build())

To dynamically swap database out, replace the FlowConfig:

FlowManager.getDatabase(AppDatabase.class)
  .reset(DatabaseConfig.builder(AppDatabase.class)
    .databaseName("AppDatabase-2")
    .build())

Note that this will overwrite all existing database properties for a database. Any TableConfig properties missing will get ignored. Also it will delete existing db and reopen with new instance specified.

  1. @database(inMemory = ) is deprecated. Use the new builder method:
FlowManager.init(FlowConfig.builder()
    .addDatabaseConfig(DatabaseConfig.inMemoryBuilder(AppDatabase.class)
      .databaseName("AppDatabase")
      .build())
    .build())
  1. Support javax.annotation.Generated if it's on the classpath.
  2. @database(generatedClassSeparator = ) is now deprecated. It will be standardized to the default _ in a future breaking release.
  3. @OneToMany now auto-detect visibility of the reference field so isVariablePrivate() is deprecated.
  4. Can specify @ForeignKeyReference(notNull = @NotNull()) annotation for individual references. Required to specify all references on a @ForeignKey if you need to specify for one.
  5. Some better error messaging in the annotation processor so its easier to find solutions to common issues.
  6. Rename count() (deprecated) to longValue() so its more clear exactly what is happening.
  7. fix Enum field with TypeConverter doesn't work in WHERE clause that uses alias #1401 which enables custom TypeConverters to carry into an as() alias of a Property.
  8. Add new TransactionWrapper which allows grouping of ITransaction into one to get executed at same point in db time.
  9. Lib now compiles with SDK 26 with latest build tools including api/implementation of 3.0.0+ gradle plugin.
  10. RXJava2 is now updated to 2.1.3
  11. Update some methods of dbflow-kotlin-extensions to accept nullable values for objects where it makes sense. See commit
  12. Automatic creation of tables can be turned off on a table-by-table basis with createWithDatabase(). Useful for preserving scrapped table in previous migrations.
  13. Using Kotlin we can drastically reduce the @OneToMany code implementation:
    @OneToMany(methods = {OneToMany.Method.ALL}, variableName = "ants")
    public List<Ant> getMyAnts() {
        if (ants == null || ants.isEmpty()) {
            ants = SQLite.select()
                .from(Ant.class)
                .where(Ant_Table.queen_id.eq(id))
                .queryList();
        }
        return ants;
    }

to:

@get:OneToMany(methods = arrayOf(OneToMany.Method.ALL))
var ants by oneToMany { select from Ant::class where (Ant_Table.queen_id.eq(id)) }

dwayne-roadhouse and others added 30 commits October 3, 2016 18:11
Properly use the getName() method that subclasses have the implement.
No need to keep a 'name' member around for this purpose. Re-enable
previously broken test.
… if they reference a QueryModel. Will work on making that not a requirement at a later time.
…bjects. Dont need annotation on class if don't want.
…b with destroying the file. Allow applying new DB config to manager.
…creation

Fixed bug where migration would fail due to a new view referencing a migrated column
…nd extension. also database definition.reset(context). move processor away from autoservice and just define service file.
…getter must exist. add oneTomany delegate to make super concise one to many.
…d databases. add kaptAndroidTest to project.
fuzzagrosner and others added 15 commits July 21, 2017 08:47
…o check if model has id specified. If not specified, assigns it an id, otherwise uses the id in the insert.
…lled. Not confused with count() operator. Simplify base transformable overrides.
fix to #1401: withTable now works for TypeConvertedProperty
@agrosner agrosner merged commit bc1cf60 into master Aug 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enum field with TypeConverter doesn't work in WHERE clause that uses alias
4 participants