Example #1
0
 void Create(DataStoreContext store)
 {
     store.CreateDatabase();
     var schemaUpdater = store.CreateDatabaseSchemaUpdater();
     schemaUpdater.DatabaseSchemaVersion = CURRENT_VERSION;
     schemaUpdater.Execute();
 }
Example #2
0
        public void Upgrade(DataStoreContext store)
        {
            if (!store.DatabaseExists())
            {
                Create(store);
                return;
            }

            var schema  = store.CreateDatabaseSchemaUpdater();
            int version = schema.DatabaseSchemaVersion;

            switch (version)
            {
                case 0 : schema.AddColumn<Options>("AutoRefresh");        goto case 1;
                case 1 : schema.AddTable<UpcomingTransaction>();          goto case 2;
                case 2 : schema.AddColumn<LoginDetails>("Pin");           goto case 3;
                case 3 : schema.AddTable<TransferToAccount>();            goto case 4;
                case 4 : schema.AddColumn<TransferToAccount>("SenderId"); goto case 5;
                case 5 : schema.AddTable<ScreenSecurity>();               break;

                default : return;
            }

            schema.DatabaseSchemaVersion = CURRENT_VERSION;
            schema.Execute();
        }