private void CreateTableRevision(IDbConnection db, IDbTransaction t, int revision)
        {
            var viewName = GetResourceName();

            {
                var sql = SqliteBuilder.CreateTableSql(viewName, _members, revision, false);
                db.Execute(sql, transaction: t);
            }

            if (SupportsSearch)
            {
                var sql = SqliteBuilder.AfterInsertTriggerSql(viewName, _members, revision);
                db.Execute(sql, transaction: t);
            }

            foreach (var member in _members.GetValueTypeFields())
            {
                if (member.Name.Equals(nameof(IResource.Id)))
                {
                    IndexMember(db, t, revision, member, true);
                }

                if (member.HasAttribute <IndexAttribute>())
                {
                    IndexMember(db, t, revision, member, false);
                }
            }

            // FIXME: deal with user field name collisions
            {
                var sql = SqliteBuilder.CreateIndexSql(GetResourceName(), "IsDeleted", revision, false);
                db.Execute(sql, transaction: t);
            }

            if (SupportsSearch)
            {
                var sql = SqliteBuilder.CreateTableSql(viewName, _members, revision, true);
                db.Execute(sql, transaction: t);
            }
        }
        private void IndexMember(IDbConnection db, IDbTransaction t, int revision, AccessorMember member, bool unique)
        {
            var sql = SqliteBuilder.CreateIndexSql(GetResourceName(), member.Name, revision, unique);

            db.Execute(sql, transaction: t);
        }