Exemple #1
0
        public FunctionName[] SchemaFunctionNames()
        {
            Func <DbDataReader, FunctionName> transform = r => new FunctionName(r.GetString(0), r.GetString(1));

            var sql =
                "SELECT specific_schema, routine_name FROM information_schema.routines WHERE type_udt_name != 'trigger' and routine_name like ? and specific_schema = ANY(?);";

            return
                (_factory.Fetch(sql, transform, DocumentMapping.MartenPrefix + "%", _schema.AllSchemaNames()).ToArray());
        }
Exemple #2
0
        public void CompletelyRemoveAll()
        {
            using (var connection = new ManagedConnection(_factory, CommandRunnerMode.Transactional))
            {
                var schemaTables = _schema.DbObjects.SchemaTables();
                schemaTables
                .Each(tableName => { connection.Execute($"DROP TABLE IF EXISTS {tableName} CASCADE;"); });

                var drops = connection.GetStringList(DropAllFunctionSql, new object[] { _schema.AllSchemaNames() });
                drops.Each(drop => connection.Execute(drop));
                connection.Commit();

                _schema.ResetSchemaExistenceChecks();
                _schema.RebuildSystemFunctions();
            }
        }