package de.philipphager.disclosure.database.migration.version;

import android.database.sqlite.SQLiteDatabase;
import de.philipphager.disclosure.database.app.model.App;
import de.philipphager.disclosure.database.library.model.Library;
import de.philipphager.disclosure.database.library.model.LibraryApp;
import de.philipphager.disclosure.database.library.populator.LibraryPopulator;
import de.philipphager.disclosure.database.migration.Migration;
import de.philipphager.disclosure.database.version.model.Version;

public class AddLibraryMigration implements Migration {
  @Override public void update(SQLiteDatabase db) {
    db.execSQL("DROP TABLE IF EXISTS " + LibraryApp.TABLE_NAME);
    db.execSQL("DROP TABLE IF EXISTS " + Library.TABLE_NAME);
    db.execSQL("DROP TABLE IF EXISTS " + Version.TABLE_NAME);
    db.execSQL("DROP TABLE IF EXISTS " + App.TABLE_NAME);

    db.execSQL(App.CREATE_TABLE);
    db.execSQL(Version.CREATE_TABLE);
    db.execSQL(Library.CREATE_TABLE);
    db.execSQL(LibraryApp.CREATE_TABLE);
    new LibraryPopulator().populate(db);
  }
}

@@ -615,35 +615,43 @@
 e db) %7B%0A    
-db.execSQL(
+String dropTable = 
 %22DROP TABLE 
@@ -651,36 +651,83 @@
  TABLE IF EXISTS
- %22 +
+%22;%0A    db.execSQL(String.format(%22%25s %25s%22, dropTable,
  LibraryApp.TABL
@@ -725,32 +725,33 @@
 yApp.TABLE_NAME)
+)
 ;%0A    db.execSQL
@@ -755,33 +755,41 @@
 SQL(
-%22DROP TABLE IF EXISTS %22 +
+String.format(%22%25s %25s%22, dropTable,
  Lib
@@ -796,32 +796,33 @@
 rary.TABLE_NAME)
+)
 ;%0A    db.execSQL
@@ -826,33 +826,41 @@
 SQL(
-%22DROP TABLE IF EXISTS %22 +
+String.format(%22%25s %25s%22, dropTable,
  Ver
@@ -875,16 +875,17 @@
 LE_NAME)
+)
 ;%0A    db
@@ -897,33 +897,41 @@
 SQL(
-%22DROP TABLE IF EXISTS %22 +
+String.format(%22%25s %25s%22, dropTable,
  App
@@ -942,16 +942,17 @@
 LE_NAME)
+)
 ;%0A%0A    d

Remove duplicated string literals