[contestms] Better way to drop the database

  • From: Giovanni Mascellani <mascellani@xxxxxxxxxxxxxxxxxxxx>
  • To: contestms@xxxxxxxxxxxxx
  • Date: Tue, 28 May 2013 23:09:57 +0200

Hi.

I just fixed #153 [1].

 [1] https://github.com/cms-dev/cms/issues/153

The fix is avoiding using metadata.drop_all(), which has some
shortcomings, but directly wipe the data in the database directly using
some SQL statements.

Unfortunately, this requires some privileges that the createdb script
doesn't set by default. Thus, when executing createdb to create a new
PostgreSQL database, you have to execute a couple of additional commands
(as written in the documentation).

This doesn't mean that current databases have to be recreated from
scratches: it is sufficient to execute the same commands as PostgreSQL
superuser (i.e., sudo-ing to the user "postgres"). Moreover, you just
need them if you actually want to drop the content of a database.

If you don't grant these privileges and want to drop a database, CMS
will complain and will tell you do give him the privileges (repeating
the required commands).

Giovanni.
-- 
Giovanni Mascellani <mascellani@xxxxxxxxxxxxxxxxxxxx>
Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani
Jabber: g.mascellani@xxxxxxxxxx / giovanni@xxxxxxxxxxxxxxxxxxxx

Attachment: signature.asc
Description: OpenPGP digital signature

Other related posts:

  • » [contestms] Better way to drop the database - Giovanni Mascellani