open method
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-v1.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, " +
"$columnUid TEXT, " +
"$columnType TEXT, " +
"$columnContent TEXT, " +
"$columnStatus TEXT, " +
"$columnCreatedAt TEXT, " +
"$columnClient TEXT, " +
"$columnExtra TEXT, " +
//
"$columnThreadTopic TEXT, " +
//
"$columnUserUid TEXT, " +
"$columnUserNickname TEXT, " +
"$columnUserAvatar TEXT, " +
//
"$columnCurrentUid TEXT)");
},
// Set the version. This executes the onCreate function and provides a
// path to perform database upgrades and downgrades.
version: 1,
);
// 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}');
}