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

Migration_11_12.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: d37916e81e08de2c7d90fb28ea859d7c3610bd32 (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
28
29
30
31
32
package it.niedermann.owncloud.notes.persistence.migration;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

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

import it.niedermann.owncloud.notes.persistence.CapabilitiesWorker;
import it.niedermann.owncloud.notes.shared.model.ApiVersion;

public class Migration_11_12 extends Migration {
    @NonNull
    private final Context context;

    public Migration_11_12(@NonNull Context context) {
        super(11, 12);
        this.context = context;
    }

    /**
     * Adds columns to store the {@link ApiVersion} and the theme colors
     */
    @Override
    public void migrate(@NonNull SupportSQLiteDatabase db) {
        db.execSQL("ALTER TABLE ACCOUNTS ADD COLUMN API_VERSION TEXT");
        db.execSQL("ALTER TABLE ACCOUNTS ADD COLUMN COLOR VARCHAR(6) NOT NULL DEFAULT '000000'");
        db.execSQL("ALTER TABLE ACCOUNTS ADD COLUMN TEXT_COLOR VARCHAR(6) NOT NULL DEFAULT '0082C9'");
        CapabilitiesWorker.update(context);
    }
}