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

Migration_4_5.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: 612ed1cbd40baa06dce19b2bdf4b42f942b57030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package it.niedermann.owncloud.notes.persistence.migration;

import android.database.sqlite.SQLiteDatabase;

import androidx.annotation.NonNull;

import it.niedermann.owncloud.notes.model.DBStatus;

public class Migration_4_5 {
    /**
     * Differentiate between local id and remote id
     */
    public Migration_4_5(@NonNull SQLiteDatabase db) {
        db.execSQL("ALTER TABLE NOTES ADD COLUMN REMOTEID INTEGER");
        db.execSQL("UPDATE NOTES SET REMOTEID=ID WHERE (REMOTEID IS NULL OR REMOTEID=0) AND STATUS!=?", new String[]{"LOCAL_CREATED"});
        db.execSQL("UPDATE NOTES SET REMOTEID=0, STATUS=? WHERE STATUS=?", new String[]{DBStatus.LOCAL_EDITED.getTitle(), "LOCAL_CREATED"});
    }
}