title: Sqlite migration in flutter
body: <p>I am using flutter SQflite to store data in flutter and I have no problem with it so far. Now I want to update my app and the database with it. Until now I was simply replacing the old database with the new one. But now there are some tables that I want to keep there data (user data). How can I replace some tables and keep others? (there is no change in tables structure so far)
  Edit: I am creating and filling the database outside flutter using DB browser for SQlite (of course except for user in app data)</p>
  
  <pre><code>     Future&lt;void&gt; initDatabase() async {
      var databasesPath = await getDatabasesPath();
      var path = join(databasesPath, "recipes.db");
  
  // Check if the database exists
      var exists = await databaseExists(path);
  
      if (!exists) {
        // Should happen only the first time you launch your application
        print("Creating new copy of database from asset");
  
        // Make sure the parent directory exists
        try {
          await Directory(dirname(path)).create(recursive: true);
        } catch (_) {}
  
        // Copy from asset
        ByteData data = await rootBundle.load(join("assets", "recipes.db"));
        List&lt;int&gt; bytes =
        data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
  
        // Write and flush the bytes written
        await File(path).writeAsBytes(bytes, flush: true);
  
      } else {
        print("Opening existing database");
      }
  // open the database
  
      db = await openDatabase(path,version: 2, readOnly: false);
    }
  </code></pre>