public class KittySimpleMigrationScriptGenerator
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
KittySimpleMigrationScriptGenerator.DIFF_STATES |
class |
KittySimpleMigrationScriptGenerator.DiffElement
Diff model
|
(package private) class |
KittySimpleMigrationScriptGenerator.GeneratedDiffResult
GenerateDiffResults class designed to be used as result of
generateDiffs(KittyDatabaseConfiguration, ArrayList, ArrayList, HashMap) |
static class |
KittySimpleMigrationScriptGenerator.TYPE |
Modifier and Type | Field and Description |
---|---|
(package private) android.content.Context |
ctx |
(package private) android.database.sqlite.SQLiteDatabase |
database |
(package private) KittyDatabaseConfiguration |
databaseConfiguration |
KittySimpleMigrationScriptGenerator.GeneratedDiffResult |
diffs |
(package private) java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> |
existingColumnNames |
(package private) java.util.ArrayList<java.lang.String> |
existingIndexNames |
(package private) java.util.ArrayList<java.lang.String> |
existingTableNames |
(package private) static java.lang.String |
I_FETCHED_EXISTING_COLUMN |
(package private) static java.lang.String |
I_FETCHED_EXISTING_COLUMN_AMOUNT |
(package private) static java.lang.String |
I_FETCHING_EXISTING_COLUMNS |
(package private) static java.lang.String |
I_FETCHING_INDEXES_NAMES |
(package private) static java.lang.String |
I_FETCHING_TABLE_NAMES |
(package private) static java.lang.String |
I_FOUND_INDEX |
(package private) static java.lang.String |
I_FOUND_INDEX_AMOUNT |
(package private) static java.lang.String |
I_FOUND_TABLE |
(package private) static java.lang.String |
I_FOUND_TABLE_AMOUNT |
(package private) static java.lang.String |
I_GENERATED_DIFFS |
(package private) static java.lang.String |
I_GENERATING_DIFFS |
(package private) static java.lang.String |
I_PRINTING_GENERATED_DIFFS |
(package private) static java.lang.String |
I_STARTED |
(package private) static java.lang.String |
IA_TYPE_MISMATCH |
Constructor and Description |
---|
KittySimpleMigrationScriptGenerator(android.content.Context ctx,
KittyDatabaseConfiguration databaseConfiguration,
android.database.sqlite.SQLiteDatabase database)
At this constructor would be generated diff collection.
|
Modifier and Type | Method and Description |
---|---|
java.util.LinkedList<KittySQLiteQuery> |
generateAlterTableWithNewColumns(KittySimpleMigrationScriptGenerator.DiffElement element,
java.util.HashMap<java.lang.String,KittyTableConfiguration> newTables,
java.lang.String schemaName)
Returns alter table add columns query sequence
|
java.util.LinkedList<KittySQLiteQuery> |
generateAlterTableWithRedundantColumns(KittyTableConfiguration conf,
KittySimpleMigrationScriptGenerator.DiffElement element)
Generates query sequence that doing following things:
Renames current existing table to new name Creates new table without redundant columns Copies fields same fields from old table to new one Wipes old table |
java.util.LinkedList<KittySQLiteQuery> |
generateMigrationScript()
Generates migration script sequence
|
final android.content.Context ctx
final KittyDatabaseConfiguration databaseConfiguration
final android.database.sqlite.SQLiteDatabase database
final java.util.ArrayList<java.lang.String> existingTableNames
final java.util.ArrayList<java.lang.String> existingIndexNames
final java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> existingColumnNames
static final java.lang.String I_STARTED
static final java.lang.String I_FETCHING_TABLE_NAMES
static final java.lang.String I_FOUND_TABLE
static final java.lang.String I_FOUND_TABLE_AMOUNT
static final java.lang.String I_FETCHING_INDEXES_NAMES
static final java.lang.String I_FOUND_INDEX
static final java.lang.String I_FOUND_INDEX_AMOUNT
static final java.lang.String I_FETCHING_EXISTING_COLUMNS
static final java.lang.String I_FETCHED_EXISTING_COLUMN
static final java.lang.String I_FETCHED_EXISTING_COLUMN_AMOUNT
static final java.lang.String I_GENERATING_DIFFS
static final java.lang.String I_GENERATED_DIFFS
static final java.lang.String I_PRINTING_GENERATED_DIFFS
static final java.lang.String IA_TYPE_MISMATCH
public final KittySimpleMigrationScriptGenerator.GeneratedDiffResult diffs
public KittySimpleMigrationScriptGenerator(android.content.Context ctx, KittyDatabaseConfiguration databaseConfiguration, android.database.sqlite.SQLiteDatabase database)
ctx
- databaseConfiguration
- database
- public final java.util.LinkedList<KittySQLiteQuery> generateMigrationScript()
public java.util.LinkedList<KittySQLiteQuery> generateAlterTableWithNewColumns(KittySimpleMigrationScriptGenerator.DiffElement element, java.util.HashMap<java.lang.String,KittyTableConfiguration> newTables, java.lang.String schemaName)
element
- newTables
- schemaName
- public java.util.LinkedList<KittySQLiteQuery> generateAlterTableWithRedundantColumns(KittyTableConfiguration conf, KittySimpleMigrationScriptGenerator.DiffElement element)
conf
- element
-