-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: alperozturk <[email protected]>
- Loading branch information
1 parent
8104a2d
commit 4c3b5c8
Showing
4 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/nextcloud/client/database/migrations/Migration84to85.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Nextcloud - Android Client | ||
* | ||
* SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected]> | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
package com.nextcloud.client.database.migrations | ||
|
||
import androidx.room.migration.Migration | ||
import androidx.sqlite.db.SupportSQLiteDatabase | ||
import com.owncloud.android.db.ProviderMeta | ||
|
||
@Suppress("MagicNumber", "NestedBlockDepth") | ||
val Migration84to85 = object : Migration(84, 85) { | ||
override fun migrate(db: SupportSQLiteDatabase) { | ||
db.run { | ||
execSQL( | ||
""" | ||
CREATE TABLE IF NOT EXISTS `offline_operations_new` ( | ||
`_id` INTEGER PRIMARY KEY AUTOINCREMENT, | ||
`offline_operations_parent_oc_file_id` INTEGER, | ||
`offline_operations_path` TEXT, | ||
`offline_operations_type` TEXT, | ||
`offline_operations_file_name` TEXT, | ||
`offline_operations_created_at` INTEGER | ||
) | ||
""" | ||
) | ||
|
||
execSQL( | ||
""" | ||
INSERT INTO offline_operations_new | ||
SELECT _id, offline_operations_parent_oc_file_id, offline_operations_path, | ||
offline_operations_type, offline_operations_file_name, offline_operations_created_at | ||
FROM ${ProviderMeta.ProviderTableMeta.OFFLINE_OPERATION_TABLE_NAME} | ||
""" | ||
) | ||
|
||
execSQL("DROP TABLE ${ProviderMeta.ProviderTableMeta.OFFLINE_OPERATION_TABLE_NAME}") | ||
execSQL( | ||
"ALTER TABLE offline_operations_new RENAME TO " + | ||
ProviderMeta.ProviderTableMeta.OFFLINE_OPERATION_TABLE_NAME | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters