open method

Future open()

Implementation

Future open() async {
  // Open the database and store the reference.
  database = await openDatabase(
    // Set the path to the database. Note: Using the `join` function from the
    // `path` package is best practice to ensure the path is correctly
    // constructed for each platform.
    join(await getDatabasesPath(), 'bytedesk-message-v10.db'),
    // When the database is first created, create a table to store dogs.
    onCreate: (db, version) {
      // Run the CREATE TABLE statement on the database. autoincrement
      return db.execute(
        "CREATE TABLE $tableMessage($columnId INTEGER PRIMARY KEY AUTOINCREMENT, $columnMid TEXT, $columnType TEXT, $columnTopic TEXT, $columnContent TEXT, $columnImageUrl TEXT, $columnVoiceUrl TEXT,$columnVideoUrl TEXT, $columnFileUrl TEXT, $columnNickname TEXT, $columnAvatar TEXT, $columnStatus TEXT, $columnIsSend INTEGER, $columnTimestamp TEXT, $columnCurrentUid TEXT, $columnClient TEXT, $columnAnswers TEXT, $columnCategories TEXT)",
      );
    },
    // Set the version. This executes the onCreate function and provides a
    // path to perform database upgrades and downgrades.
    version: 10,
  );
  // database path:/Users/ningjinpeng/Library/Developer/CoreSimulator/Devices/9B8D4445-E6DE-42A4-AEF0-6668B684D2DB/data/Containers/Data/Application/E7501356-E8A6-45A8-AF63-437348AEDCC3/Documents/bytedesk-message-v10.db
  // debugPrint('database path:${database!.path}');
}