
from __future__ import absolute_import, unicode_literals

from peewee import Model, IntegerField, CharField

from zhihudaily.configs import Config


class BaseModel(Model):
    class Meta:
        database = Config.database


class Zhihudaily(BaseModel):
    date = IntegerField()
    json_news = CharField()
    display_date = CharField()


def create_tables():
    database.connect()
    database.create_tables([Zhihudaily])


from __future__ import absolute_import, unicode_literals

from peewee import Model, IntegerField, CharField

from zhihudaily.configs import Config


class BaseModel(Model):
    class Meta:
        database = Config.database


class Zhihudaily(BaseModel):
    date = IntegerField()
    json_news = CharField()
    display_date = CharField()


def create_tables():
    Config.database.connect()
    Config.database.create_tables([Zhihudaily])

Fix bug when create the datebase table
Fix bug when create the datebase table

  
  from __future__ import absolute_import, unicode_literals
  
  from peewee import Model, IntegerField, CharField
  
  from zhihudaily.configs import Config
  
  
  class BaseModel(Model):
      class Meta:
          database = Config.database
  
  
  class Zhihudaily(BaseModel):
      date = IntegerField()
      json_news = CharField()
      display_date = CharField()
  
  
  def create_tables():
-     database.connect()
+     Config.database.connect()
-     database.create_tables([Zhihudaily])
+     Config.database.create_tables([Zhihudaily])
  
Fix bug when create the datebase table
## Code Before:

from __future__ import absolute_import, unicode_literals

from peewee import Model, IntegerField, CharField

from zhihudaily.configs import Config


class BaseModel(Model):
    class Meta:
        database = Config.database


class Zhihudaily(BaseModel):
    date = IntegerField()
    json_news = CharField()
    display_date = CharField()


def create_tables():
    database.connect()
    database.create_tables([Zhihudaily])

## Instruction:
Fix bug when create the datebase table
## Code After:

from __future__ import absolute_import, unicode_literals

from peewee import Model, IntegerField, CharField

from zhihudaily.configs import Config


class BaseModel(Model):
    class Meta:
        database = Config.database


class Zhihudaily(BaseModel):
    date = IntegerField()
    json_news = CharField()
    display_date = CharField()


def create_tables():
    Config.database.connect()
    Config.database.create_tables([Zhihudaily])
