database property

Future<AppDatabase> get database

Implementation

Future<AppDatabase> get database async {
  final migration1to2 = Migration(1, 2, (database) async {
    await database.execute(
        'ALTER TABLE popups ADD COLUMN createdAt TEXT NOT NULL DEFAULT "default_value"');
  });

  // Initialize the database if it hasn't been already
  _database ??= await $FloorAppDatabase.databaseBuilder('app_database.db').addMigrations([migration1to2]).build();
  return _database!;
}