ask web2py to repair it

auth.define_tables(fake_migrate=True)

On Mar 19, 10:16 pm, VP <vtp2...@gmail.com> wrote:
> I've had problems with backup/restore.  These could be very serious
> problems.  So,  with version 1.94.5, I simulated a backup/restore
> scenario and found a problem.
>
> 1. Backup up database with (psql_dump database > database.sql)
>
> 2. Create another database (psql database2 < database.sql)
>
> 3. Replace "database" in the connection string with "database2".
>
> These 3 steps is to simulate a backup/restore scenario.  The
> (uncompiled) codebase remains unchanged during these 3 steps.
>
> One would think this should work, but it doesn't; at least with my
> app.   Here's the error's trackback:
>
> Traceback (most recent call last):
>   File "/home/username/web2py/gluon/restricted.py", line 188, in
> restricted
>     exec ccode in environment
>   File "/home/username/web2py/applications/phim/models/db.py", line
> 42, in <module>
>     auth.define_tables()                           # creates all
> needed tables
>   File "/home/username/web2py/gluon/tools.py", line 1177, in
> define_tables
>     format='%(first_name)s %(last_name)s (%(id)s)')
>   File "/home/username/web2py/gluon/dal.py", line 3884, in
> define_table
>     polymodel=polymodel)
>   File "/home/username/web2py/gluon/dal.py", line 581, in create_table
>     self.create_sequence_and_triggers(query,table)
>   File "/home/username/web2py/gluon/dal.py", line 1575, in
> create_sequence_and_triggers
>     self.execute(query)
>   File "/home/username/web2py/gluon/dal.py", line 1137, in execute
>     return self.log_execute(*a, **b)
>   File "/home/username/web2py/gluon/dal.py", line 1134, in log_execute
>     return self.cursor.execute(*a,**b)
> ProgrammingError: relation "auth_user" already exists
>
> =====
>
> PS: btw, I'm not modifying auth in anyway.  It's web2py's default.

Reply via email to