Esempio n. 1
0
        public void DropColumns(string tableName, IEnumerable <string> columns)
        {
            using (var transaction = _sqLiteMigrationHelper.BeginTransaction())
            {
                var originalColumns = _sqLiteMigrationHelper.GetColumns(tableName);
                var originalIndexes = _sqLiteMigrationHelper.GetIndexes(tableName);

                var newColumns = originalColumns.Where(c => !columns.Contains(c.Key)).Select(c => c.Value).ToList();
                var newIndexes = originalIndexes.Where(c => !columns.Contains(c.Column));

                CreateTable(tableName, newColumns, newIndexes);

                transaction.Commit();
            }
        }