Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class LegacyMigration(
private val context: Context
) : Migration(from, to) {

override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
LegacyMigrationHelper(clock, context)
.tryUpgrade(database, from, to)
.tryUpgrade(db, from, to)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.nextcloud.client.database.migrations.DatabaseMigrationUtil.TYPE_TEXT
*/
@Suppress("MagicNumber")
class Migration67to68 : Migration(67, 68) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
val tableName = "filelist"
val newTableTempName = "${tableName}_new"
val newColumns = mapOf(
Expand Down Expand Up @@ -70,7 +70,7 @@ class Migration67to68 : Migration(67, 68) {
"lock_token" to TYPE_TEXT
)

DatabaseMigrationUtil.migrateTable(database, "filelist", newColumns) { columnName ->
DatabaseMigrationUtil.migrateTable(db, "filelist", newColumns) { columnName ->
when (columnName) {
"local_id" -> "IFNULL(local_id, -1)"
else -> columnName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import com.owncloud.android.db.ProviderMeta.ProviderTableMeta

@Suppress("MagicNumber")
val MIGRATION_88_89 = object : Migration(88, 89) {
override fun migrate(database: SupportSQLiteDatabase) {
override fun migrate(db: SupportSQLiteDatabase) {
DatabaseMigrationUtil.addColumnIfNotExists(
database,
db,
ProviderTableMeta.FILE_TABLE_NAME,
ProviderTableMeta.FILE_UPLOADED,
SQLiteColumnType.INTEGER_DEFAULT_NULL
)
DatabaseMigrationUtil.addColumnIfNotExists(
database,
db,
ProviderTableMeta.CAPABILITIES_TABLE_NAME,
ProviderTableMeta.CAPABILITIES_NOTES_FOLDER_PATH,
SQLiteColumnType.TEXT_DEFAULT_NULL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ import com.nextcloud.client.database.migrations.DatabaseMigrationUtil.TYPE_TEXT

class RoomMigration : Migration(NextcloudDatabase.FIRST_ROOM_DB_VERSION - 1, NextcloudDatabase.FIRST_ROOM_DB_VERSION) {

override fun migrate(database: SupportSQLiteDatabase) {
migrateFilesystemTable(database)
migrateUploadsTable(database)
migrateCapabilitiesTable(database)
migrateFilesTable(database)
override fun migrate(db: SupportSQLiteDatabase) {
migrateFilesystemTable(db)
migrateUploadsTable(db)
migrateCapabilitiesTable(db)
migrateFilesTable(db)
}

/**
* filesystem table: STRING converted to TEXT
*/
private fun migrateFilesystemTable(database: SupportSQLiteDatabase) {
private fun migrateFilesystemTable(db: SupportSQLiteDatabase) {
val newColumns = mapOf(
"_id" to TYPE_INTEGER_PRIMARY_KEY,
"local_path" to TYPE_TEXT,
Expand All @@ -38,13 +38,13 @@ class RoomMigration : Migration(NextcloudDatabase.FIRST_ROOM_DB_VERSION - 1, Nex
"modified_at" to TYPE_INTEGER
)

DatabaseMigrationUtil.migrateTable(database, "filesystem", newColumns)
DatabaseMigrationUtil.migrateTable(db, "filesystem", newColumns)
}

/**
* uploads table: LONG converted to INTEGER
*/
private fun migrateUploadsTable(database: SupportSQLiteDatabase) {
private fun migrateUploadsTable(db: SupportSQLiteDatabase) {
val newColumns = mapOf(
"_id" to TYPE_INTEGER_PRIMARY_KEY,
"local_path" to TYPE_TEXT,
Expand All @@ -64,13 +64,13 @@ class RoomMigration : Migration(NextcloudDatabase.FIRST_ROOM_DB_VERSION - 1, Nex
"folder_unlock_token" to TYPE_TEXT
)

DatabaseMigrationUtil.migrateTable(database, "list_of_uploads", newColumns)
DatabaseMigrationUtil.migrateTable(db, "list_of_uploads", newColumns)
}

/**
* capabilities table: "files_drop" column removed
*/
private fun migrateCapabilitiesTable(database: SupportSQLiteDatabase) {
private fun migrateCapabilitiesTable(db: SupportSQLiteDatabase) {
val newColumns = mapOf(
"_id" to TYPE_INTEGER_PRIMARY_KEY,
"account" to TYPE_TEXT,
Expand Down Expand Up @@ -122,13 +122,13 @@ class RoomMigration : Migration(NextcloudDatabase.FIRST_ROOM_DB_VERSION - 1, Nex
"files_locking_version" to TYPE_TEXT
)

DatabaseMigrationUtil.migrateTable(database, "capabilities", newColumns)
DatabaseMigrationUtil.migrateTable(db, "capabilities", newColumns)
}

/**
* files table: "public_link" column removed
*/
private fun migrateFilesTable(database: SupportSQLiteDatabase) {
private fun migrateFilesTable(db: SupportSQLiteDatabase) {
val newColumns = mapOf(
"_id" to TYPE_INTEGER_PRIMARY_KEY,
"filename" to TYPE_TEXT,
Expand Down Expand Up @@ -174,6 +174,6 @@ class RoomMigration : Migration(NextcloudDatabase.FIRST_ROOM_DB_VERSION - 1, Nex
"lock_timeout" to TYPE_INTEGER,
"lock_token" to TYPE_TEXT
)
DatabaseMigrationUtil.migrateTable(database, "filelist", newColumns)
DatabaseMigrationUtil.migrateTable(db, "filelist", newColumns)
}
}
Loading