Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Migration_6_7.java « migration « persistence « notes « owncloud « niedermann « it « java « main « src « app - github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 327841d98d155260e6360b733aff1ee6f89b8671 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package it.niedermann.owncloud.notes.persistence.migration;

import android.database.sqlite.SQLiteDatabase;

import androidx.annotation.NonNull;
import androidx.room.migration.Migration;
import androidx.sqlite.db.SupportSQLiteDatabase;

import it.niedermann.owncloud.notes.shared.util.DatabaseIndexUtil;

public class Migration_6_7 extends Migration {

    public Migration_6_7() {
        super(6, 7);
    }

    /**
     * Adds columns for category support and ETags
     */
    @Override
    public void migrate(@NonNull SupportSQLiteDatabase db) {
        DatabaseIndexUtil.dropIndexes(db);
        db.execSQL("ALTER TABLE NOTES ADD COLUMN CATEGORY TEXT NOT NULL DEFAULT ''");
        db.execSQL("ALTER TABLE NOTES ADD COLUMN ETAG TEXT");
        DatabaseIndexUtil.createIndex(db, "NOTES", "REMOTEID", "STATUS", "FAVORITE", "CATEGORY", "MODIFIED");
    }
}