The manual is pretty explicit about this although it simplifies a
bit.  The manual says it looks at the existing tables (actually looks
at the physical file or looks at the most recent definition in
sql.log?).  I think that the time stamps also matter. Not clear what
timestamp is being compared to what...

I followed the manual and did the "fake_migrate=True" thing.  As the
db tables already really did match, that as a sure thing and the app
works again without migrate = False.  I am curious why the initial
migration did not work.  It would seem that the sequence that needed
to happen is:
i. create new tmp column
ii. assign values of column being changed to tmp column
iii. create new column
iv. assign values of tmp column to new column--if appropriate
v. drop tmp column
I think my migration failed on step iii, create new column, because I
did not specify the Field arguments properly.  Let me know if you have
any suggestions.

<stop here--sql logs probably not so interesting.>

I am still curious about this.  Here is my sql.log file BEFORE doing
the fake_migrate.  Immediately following that is the sql.log after the
successful fake_migrate.  The Alter table sql statements are still
present.  that sort of concerns me.  Can I simply purge the log and
let web2py update it with the application's next execution?  Perhaps
it is the <string>_name.table files that really determine what happens
in migrations.


timestamp: 2012-01-11T21:33:41.500000
CREATE TABLE auth_user(
    id INT AUTO_INCREMENT NOT NULL,
    first_name VARCHAR(128),
    last_name VARCHAR(128),
    email VARCHAR(255),
    password VARCHAR(255),
    registration_key VARCHAR(255),
    reset_password_key VARCHAR(255),
    registration_id VARCHAR(255),
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
timestamp: 2012-01-11T21:46:05.797000
CREATE TABLE auth_user(
    id INT AUTO_INCREMENT NOT NULL,
    first_name VARCHAR(128),
    last_name VARCHAR(128),
    email VARCHAR(255),
    password VARCHAR(255),
    registration_key VARCHAR(255),
    reset_password_key VARCHAR(255),
    registration_id VARCHAR(255),
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
timestamp: 2012-01-11T22:04:00.147000
CREATE TABLE auth_user(
    id INT AUTO_INCREMENT NOT NULL,
    first_name VARCHAR(128),
    last_name VARCHAR(128),
    email VARCHAR(255),
    password VARCHAR(255),
    registration_key VARCHAR(255),
    reset_password_key VARCHAR(255),
    registration_id VARCHAR(255),
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-11T22:04:00.162000
CREATE TABLE auth_group(
    id INT AUTO_INCREMENT NOT NULL,
    role VARCHAR(255),
    description LONGTEXT,
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-11T22:04:00.172000
CREATE TABLE auth_membership(
    id INT AUTO_INCREMENT NOT NULL,
    user_id INT, INDEX user_id__idx (user_id), FOREIGN KEY (user_id)
REFERENCES auth_user(id) ON DELETE CASCADE,
    group_id INT, INDEX group_id__idx (group_id), FOREIGN KEY
(group_id) REFERENCES auth_group(id) ON DELETE CASCADE,
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-11T22:04:00.186000
CREATE TABLE auth_permission(
    id INT AUTO_INCREMENT NOT NULL,
    group_id INT, INDEX group_id__idx (group_id), FOREIGN KEY
(group_id) REFERENCES auth_group(id) ON DELETE CASCADE,
    name VARCHAR(255),
    table_name VARCHAR(255),
    record_id INT,
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-11T22:04:00.198000
CREATE TABLE auth_event(
    id INT AUTO_INCREMENT NOT NULL,
    time_stamp DATETIME,
    client_ip VARCHAR(255),
    user_id INT, INDEX user_id__idx (user_id), FOREIGN KEY (user_id)
REFERENCES auth_user(id) ON DELETE CASCADE,
    origin VARCHAR(255),
    description LONGTEXT,
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-11T22:04:00.210000
CREATE TABLE auth_cas(
    id INT AUTO_INCREMENT NOT NULL,
    user_id INT, INDEX user_id__idx (user_id), FOREIGN KEY (user_id)
REFERENCES auth_user(id) ON DELETE CASCADE,
    created_on DATETIME,
    service VARCHAR(255),
    ticket VARCHAR(255),
    renew CHAR(1),
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-11T22:04:00.222000
CREATE TABLE joke(
    id INT AUTO_INCREMENT NOT NULL,
    joketext LONGTEXT,
    created_on DATETIME,
    created_by INT, INDEX created_by__idx (created_by), FOREIGN KEY
(created_by) REFERENCES auth_user(id) ON DELETE CASCADE,
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-11T22:04:00.233000
CREATE TABLE category(
    id INT AUTO_INCREMENT NOT NULL,
    name LONGTEXT,
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-11T22:04:00.243000
CREATE TABLE joke_category(
    id INT AUTO_INCREMENT NOT NULL,
    joke_id INT,
    category_id INT,
    PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-01-14T19:48:00.511000
ALTER TABLE joke_category ADD joke_id__tmp INT;
timestamp: 2012-01-14T20:17:09.334000
ALTER TABLE joke_category ADD joke_id__tmp INT;
success!
UPDATE joke_category SET joke_id__tmp=joke_id;
success!
ALTER TABLE joke_category DROP COLUMN joke_id;

Reply via email to