The only problem I even had about migrations which has causes (what
appeared to be) data loss is that if you run out of disk space
the .table files may get corrupted. There is no actual loss of data
but when this happens, one needs to recover some disk space and run
web2py in fake_migrate mode to rebuildthe missing .tables files.
This does not appear to be your case anyway. I have no idea what
happened but I am sure something else deleted the files (if they were
deleted), not web2py.

Massimo


On Feb 8, 12:18 pm, Lewis <lewis_le...@hotmail.com> wrote:
> So, good news. I cannot reproduce.
>
> Yes, Massimo:  I knew this change would invalidate passwords.  Just 3
> test accounts so that didn't matter.
>
> I backed up the data this time.  (Good to learn how to backup
> postgresql...)
>
> Switched to incorrect auth with generic hash key.  Worked.  Everything
> there.
>
> Switched back to correct auth with per app hmac_key.  Worked.
> Everything there.
>
> Interestingly, the web2py sql.log didn't show any migrations.
>
> I can't recover the postgresql log so I don't know what it saw
> (something else to fix).
>
> So, I can't say what happened.  Only other symptom is that I was
> working on the app while someone else was accessing it from the web.
>
> So, the good news is that this change (very rare as most people
> wouldn't change the auth hashing method once set up) works as
> expected.
>
> On Feb 8, 6:23 am, Anthony <abasta...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Can you reproduce the problem -- that is, first create the auth tables via
> > Auth(jodb), then fill them with some test data, then change your code to
> > Auth(jodb, hmac_key=Auth.get_or_create_key()), and observe if on the next
> > request the Auth tables are all dropped and re-created in the database?
>
> > Anthony
>
> > On Wednesday, February 8, 2012 1:03:25 AM UTC-5, Lewis wrote:
>
> > > Correction:  only the auth tables were dropped and recreated and the
> > > one table that had a foreign key to auth.  So, it is linked to the
> > > change to auth.  It looks like that instead of just hashing passwords
> > > with a different key (which would have invalidated all the old
> > > passwords, of course--this is what I thought would happen) the auth
> > > tables had to be rebuilt from scratch.
>
> > > I still have somewhat cold tingles...
>
> > > On Feb 7, 9:59 pm, Lewis <lewis_le...@hotmail.com> wrote:
> > > > I switched auth to using the proper key:
>
> > > > originally:  auth = Auth(jodb)
>
> > > > changed to:  auth = Auth(jodb, hmac_key=Auth.get_or_create_key())
>
> > > > The original worked fine.  But, it seemed that using the hmac_key was
> > > > preferred.  So I changed it.
>
> > > > Now, all the data in all tables is gone.  The auth tables are empty.
> > > > The data tables for the application itself are empty.
>
> > > > ???
>
> > > > There is nothing in sql.log.  The last entry was from a week ago
> > > > indicating successful creation of each table.  Nothing since.
>
> > > > In postgresql in the sql for each table it appears that all the tables
> > > > were dropped and created with new constraints.
>
> > > > for example:
>
> > > > -- Table: joke
>
> > > > -- DROP TABLE joke;
>
> > > > CREATE TABLE joke
> > > > (
> > > >   id serial NOT NULL,
> > > >   joketext text,
> > > >   created_on timestamp without time zone,
> > > >   created_by integer,
> > > >   CONSTRAINT joke_pkey PRIMARY KEY (id ),
> > > >   CONSTRAINT joke_created_by_fkey FOREIGN KEY (created_by)
> > > >       REFERENCES auth_user (id) MATCH SIMPLE
> > > >       ON UPDATE NO ACTION ON DELETE CASCADE
> > > > )
> > > > WITH (
> > > >   OIDS=FALSE
> > > > );
> > > > ALTER TABLE joke
> > > >   OWNER TO postgres;
>
> > > > Wow.  Have you seen DAL do this before?
>
> > > > It was just test data in a test app and I have a version from a week
> > > > ago in csv files, but wow.  That's bad.  I didn't change anything else
> > > > in the model.
>
> > > > Here are the table definitions:
>
> > > > jodb.define_table('joke',
> > > >     Field('joketext', 'text',length=2048, requires = IS_NOT_EMPTY()),
> > > >     Field('created_on', 'datetime', default=request.now),
> > > >     Field('created_by', jodb.auth_user))
>
> > > > jodb.define_table('category',
> > > >     Field('name', 'text', requires = IS_NOT_EMPTY()))
>
> > > > jodb.define_table('joke_category',
> > > >     Field('joke', jodb.joke),
> > > >     Field('category', jodb.category),
> > > >     format = '%(name)s')
>
> > > > Is this "by design"?

Reply via email to