That's a nice tool. I'm going to try it. The only problem seems that it will copy all stuff on DB level. Correct me if i'm wrong: So if you had a couple of sqlite table_name changes or column drops while developing -> then they are copied into the new Postgres DB. (In most cases that would mean a manual cleanup of web2py sqlite migration left overs; at least in our projects)
On Friday, April 25, 2014 12:24:50 PM UTC+2, Michele Comitini wrote: > > If you were to migrate to postgresql I would suggest pgloader > http://pgloader.org/howto/pgloader.1.html. > An amazing piece of code: fast, smart and robust. > Once you have moved the database to postgresql you need only to change > the connection string in db.py to connect to your new postgresql copy. > > > 2014-04-25 3:11 GMT+02:00 Rene Dohmen <[email protected] <javascript:>>: > > With some tweaking the script that Alan Proposed did work in my > situation. > > (50+ tables and a lot of references) > > > https://groups.google.com/d/msg/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ > > > > In Short: > > 1) recreate the complete model in postgres: db_new = > > DAL('postgres://user:pass@localhost/projectname', > migrate=settings.migrate, > > check_reserved=False, entity_quoting=True, bigint_id=True) > > (Still have to find a smart way to get the auth and other tables in > there; > > for now I did it manually) > > > > Let web2py create the empty tables for the db_new postgres table. > > > > 2) Place the sqlite2pg.py in modules/ > > (One small modification: I had to remove the line which truncates the > table) > > > > 3) Write a controller: > > def migrate(): > > import sqlite2pg > > sqlite2pg.migrate(db, db_new) > > > > 4) swap db_new and db in you DAL connection file. > > > > Hurray: Working postgres DB with all data. :) > > > > -- > > Resources: > > - http://web2py.com > > - http://web2py.com/book (Documentation) > > - http://github.com/web2py/web2py (Source code) > > - https://code.google.com/p/web2py/issues/list (Report Issues) > > --- > > You received this message because you are subscribed to the Google > Groups > > "web2py-users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

