sdispater / orator

The Orator ORM provides a simple yet beautiful ActiveRecord implementation.

Home Page:https://orator-orm.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Command Cancelled! on running orator migrate command

abubaker417 opened this issue · comments

@sdispater Can you please check my question.

db connection in the root

from orator import DatabaseManager
import environ
env = environ.Env()
environ.Env.read_env()

config = {
    'mysql': {
        'driver': 'mysql',
        'host': 'localhost',
        'database':  env('DB_DATABASE'),
        'user': env('DB_USERNAME'),
        'password': env('DB_PASSWORD'),
        'prefix': ''
    }
}

db = DatabaseManager(config)

migration file

from orator.migrations import Migration


class CreateProductsable(Migration):

    def up(self):
        """
        Run the migrations.
        """
        with self.schema.create('products') as table:
            table.increments('id')
            table.integer('category_id').unsigned()
            table.timestamps()

            table.foreign('category_id').references('id').on('jobs').on_delete('cascade')

    def down(self):
        """
        Revert the migrations.
        """
        self.schema.drop('products')

model file

from orator import Model


class Product(Model):

    __table__ = 'products'

Can you provide the error log ?