AttributeError: 'NoneType' object has no attribute 'safe_create_index'
Your model class does not appear to have declared a database:

```python
class MyModel(Model):
    class Meta:
        database = ...  # You are missing this.
``` > Your model class does not appear to have declared a database:
> 
> ```python
> class MyModel(Model):
>     class Meta:
>         database = ...  # You are missing this.
> ```

I am facing the same issue and database is defined in Meta. Could you please suggest a fix for this please? Share your code My apologies, I did a terrible mistake while writing the code. Instead of passing database instance under table's META, I was passing database name itself and hence this issue. But I must say the error "'NoneType' object has no attribute 'safe_create_index'" is not developer friendly. It should elaborate more to help us. It took around 1 full day for me to identify this mistake in code.
Thanks for your response, you may close this.
I'm using `SqliteExtDatabase`. When I'm trying to create tables next error raises:

```Traceback (most recent call last):
  File "/home/gurland/Projects/mathbot/bot.py", line 3, in <module>
    from models import SubscriptionChat, Subscription, IUMCourse
  File "/home/gurland/Projects/mathbot/models.py", line 119, in <module>
    db.create_tables([User, Catalog, Book, IUMCourse, SubscriptionChat, Subscription], safe=True)
  File "/home/gurland/Projects/mathbot/venv/lib/python3.6/site-packages/peewee.py", line 2774, in create_tables
    model.create_table(**options)
  File "/home/gurland/Projects/mathbot/venv/lib/python3.6/site-packages/peewee.py", line 5604, in create_table
    if safe and not cls._meta.database.safe_create_index \
AttributeError: 'NoneType' object has no attribute 'safe_create_index'```

peewee 3.5.2
python 3.6