Massimo,
I finally got it to work last night. I am not sure what I did to get it
working or why, but I manually modified the postgres tables(making sure the
fields are in the same order as the extra_fileds AND played with combinations
of Migrate=True and Fake_migrate=True. I ended up manually creating the new
table in postgres because the migrate was not doing so. In fact I do not think
migrate made any schema changes to my prod database. As I said I am not 100%
sure what I did but my working theory is the sequence of the schema mods has a
lot to do with whether or not migrate behaves properly. Migration, especially
with the auth tables, is an area that is very mysterious and frustrating. That
said I am happy to have COPSIS up and running. Tomorrow at the "2nd Annual -
Building Resilience Through Public Private Partnerships Conference" in Colorado
Springs FEMA will make the site available to all participants. I still have
work to do including an UX cleanup, about page, web2py reference, etc. Take a
look www.copsi.org - you are already a user. Thanks again for you help.
/david
On Jul 22, 2012, at 10:15 PM, Massimo Di Pierro wrote:
> I suspect you have fake_migrate=True when you added the line:
>
> Field('phone', label="Phone"),
>
> Try the solution I just posted in the other thread. IF it does not work, you
> can manually do the ALTER TABLE. web2py seems to already be aware of those
> columns.
>
> On Sunday, 22 July 2012 19:27:54 UTC-5, david.waldrop wrote:
> I create extra fields in auth_user like this
>
> ## create all tables needed by auth if not custom tables
> auth.settings.extra_fields['auth_user'] = [
> Field('org_ref', 'integer', label="Organization"),
> Field('phone', label="Phone"),
> Field('show1stpage', 'boolean', label="Show Getting Started Page"),
> Field('Invitedby', label="Invited By"),
> Field('RegistrationCode', label="Registration Code")
> ]
>
> ## create all tables needed by auth if not custom tables
> auth.define_tables(username=False, signature=False, Migrate=True)
>
>
> and am getting the following error after migrate. I have tried fake_migrate
> in all combinations.
> If i comments out the most recent fileds (i.e. the ones not in the current
> Postgres DB, the app will run, but blows up when I reference one of the new
> fields)
> If I add the fileds to the database directly (in the same order as the create
> table in the /databases/log.sql file, I get the error below
> Lastly I create a new table RegistrationCodes that is not getting created in
> the Postgres DB either. Its as if the migrate is not doing anything.
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> Traceback (most recent call last
> ):
> File "/home/dlwatey/webapps/web2py/web2py/gluon/restricted.py", line 205,
> in restricted
> exec ccode in environment
> File
> "/home/dlwatey/webapps/web2py/web2py/applications/COPSIS23/controllers/default.py",
> line 226, in <module>
> File "/home/dlwatey/webapps/web2py/web2py/gluon/globals.py", line 175, in
> <lambda>
> self._caller = lambda f: f()
> File
> "/home/dlwatey/webapps/web2py/web2py/applications/COPSIS23/controllers/default.py",
> line 85, in register
> inviterec = db((db.invite.id == request.args(0)) & (db.invite.host_ref ==
> db.auth_user.id)).select()
> File "/home/dlwatey/webapps/web2py/web2py/gluon/dal.py", line 8147, in
> select
> return adapter.select(self.query,fields,attributes)
> File "/home/dlwatey/webapps/web2py/web2py/gluon/dal.py", line 1410, in
> select
> rows = response(sql)
> File "/home/dlwatey/webapps/web2py/web2py/gluon/dal.py", line 1400, in
> response
> self.execute(sql)
> File "/home/dlwatey/webapps/web2py/web2py/gluon/dal.py", line 1489, in
> execute
> return self.log_execute(*a, **b)
> File "/home/dlwatey/webapps/web2py/web2py/gluon/dal.py", line 1483, in
> log_execute
> ret = self.cursor.execute(*a, **b)
> ProgrammingError: column auth_user.phone does not exist
> LINE 1: ...ey, auth_user.registration_id, auth_user.org_ref, auth_user....
> ^
>
> db = DAL('postgres://idxxx:[email protected]:5432/dlwatey_copsis',
> migrate_enabled=True, fake_migrate_all=False)
>
> I have tried the migrate=true, and fake_migrate flags but they are not
> working. I continue to see what is going on but am getting worried andmay
> have to revert to the old system.
>
> --
>
>
>
--