Tech

Drop All Tables in a Postgress Database

I came across an interesting technique for dropping all the tables in a PostgreSQL Database without dropping the whole database.  Just drop this little piece of code into the database and the returning set is a list of sql that can be coppied and pasted right back into the database.

[code]SELECT
‘DROP TABLE ‘||c.relname ||’ CASCADE;’
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_roles r ON r.oid = c.relowner
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN (‘r’,”)
AND n.nspname NOT IN (‘pg_catalog’, ‘pg_toast’)
AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1;[/code]

I pulled this snipped of code from http://antydba.blogspot.com/2009/10/how-to-drop-all-tables-from-database.html Many Thanks!

Tech

In Search of the Perfect Wiki

I set out on a mission this week to find the perfect wiki, I had been completely on finding a dozen or so wikis and installing them in various fashions and trying out a feature/wish list hoping that I would find one that suited all my needs and as many Wants as I could get.   I fell in love with mediawiki when I was in school to document all my projects, and keep track of my thoughts.  But the lack of ACLs has sent me back to the great cloud to seek out an alternative.

Here were my requirements

Needs

  • Open Source – This particular project had a budget of 0 dollars.  Preferably some GPL or LGPL project.
  • Written in PHP – I already have a LAMP infrastructure so Python/Java/Perl were out.
  • Flat File or MySQL page storage
  • ACLs – Must be able to make some pages readable but not editable by certain groups.
  • LDAP Authentication – Own Database ok but would prefer to centralize passwords
  • Page Versioning – Must be able to roll back changes
  • Search – Page Titles
  • Syntax Highlighting – Trust me, its just better that way.

Wants

  • Easy to setup – I know a pipe dream but there’s always hope.
  • Page Versioning – Be able to diff pages between all versions
  • Search – Full text
  • Syntax similar to MediaWiki – Its what I’m used to
  • Tagging – Have be able to order/organize the pages someway.

Then as I started my search I found a little site that took all the fun out of it.

http://www.wikimatrix.org/

The search feature quickly narrowed my search down to these few wikis. I threw MediaWIki into the works just to keep a baseline for features I would gain or lose.

http://www.wikimatrix.org/compare/DokuWiki+MoinMoin+PhpWiki+TikiWiki-CMS-Groupware+MediaWiki

These are my finalists that I will be installing an playing with.

DokuWiki

MoinMoin – was quickly discarded because it was written in python.

PHPWiki

TikiWiki

MediaWIki – I’ve heard rumors of an ACL plugin that would just barely give the amount of control needed.