Ejemplo n.º 1
0
def migrateDB(DB, version):
    util.LOG('Migrating database from version {0} to {1}'.format(
        version, DATABASE_VERSION))
    from peewee.playhouse import migrate
    migrator = migrate.SqliteMigrator(DB)
    migratorW = migrate.SqliteMigrator(W_DB)

    if version < 1:
        try:
            migrate.migrate(
                migrator.add_column('RatingsBumpers', 'style',
                                    peewee.CharField(default='Classic')))
        except peewee.OperationalError:
            util.MINOR_ERROR('Migration (RatingsBumpers: Add style column)')
        except:
            util.ERROR()
            return False

    if version < 2:
        try:
            migrate.migrate(
                migrator.add_column('RatingSystem', 'regions',
                                    peewee.CharField(null=True)),
                migrator.drop_not_null('RatingSystem', 'context'),
            )
        except peewee.OperationalError:
            util.MINOR_ERROR('Migration (RatingSystem: Add region column)')
        except:
            util.ERROR()
            return False

    if version < 5:
        try:
            migrate.migrate(
                migratorW.add_column('Trailers', 'is3D',
                                     peewee.BooleanField(default=False)), )
        except peewee.OperationalError:
            util.MINOR_ERROR('Migration (Trailers: Add is3D column)')
        except:
            util.ERROR()
            return False

    if version < 6:
        try:
            migrate.migrate(
                migratorW.add_column('Trailers', 'verified',
                                     peewee.BooleanField(default=True)), )
        except peewee.OperationalError:
            util.MINOR_ERROR('Migration (Trailers: Add verified column)')
        except:
            util.ERROR()
            return False

    return True
Ejemplo n.º 2
0
 class Trailers(WatchedBase):
     source = peewee.CharField()
     rating = peewee.CharField(null=True)
     genres = peewee.CharField(null=True)
     title = peewee.CharField()
     release = peewee.DateTimeField(default=datetime.date(1900, 1, 1))
     url = peewee.CharField(null=True)
     userAgent = peewee.CharField(null=True)
     thumb = peewee.CharField(null=True)
     broken = peewee.BooleanField(default=False)
     is3D = peewee.BooleanField(default=False)
     verified = peewee.BooleanField(default=True)
Ejemplo n.º 3
0
    class WatchedBase(peewee.Model):
        WID = peewee.CharField(unique=True)
        watched = peewee.BooleanField(default=False)
        date = peewee.DateTimeField(default=datetime.date(1900, 1, 1))

        class Meta:
            database = W_DB
Ejemplo n.º 4
0
 class BumperBase(ContentBase):
     is3D = peewee.BooleanField(default=False)
     isImage = peewee.BooleanField(default=False)
     path = peewee.CharField(unique=True)