aachurin / peewee_migrations

Migrations for peewee orm.
Other
76 stars 8 forks source link

Starting from empty database encounters errors #38

Open jefarmstrong opened 2 months ago

jefarmstrong commented 2 months ago

I have six migration files that build up the final database structure. The last one runs some SQL to add Default behavior to created_at columns.

def migrate_forward(op, old_orm, new_orm):
    database = op.obj._database
    database.execute_sql(
        """
        ALTER TABLE `UserBasicInfo` MODIFY COLUMN `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP;
        """
    )
   ......

When i run pem migrate it throws an error peewee.ProgrammingError: (1146, "Table 'db.userbasicinfo' doesn't exist")

If I just run the first 5 migrations, and then add and run the sixth, it works fine.

How do I fix this so that they all work in one migration?

gabsdocompiuter commented 1 month ago

Did you try delete all your migrations files and then run pem watch to create a single migration file with all things? And to avoid errors, truncate the migrationhistory table if exists