orator icon indicating copy to clipboard operation
orator copied to clipboard

Command Cancelled! on running orator migrate command

Open abubaker417 opened this issue 2 years ago • 1 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'

abubaker417 avatar Jun 29 '22 17:06 abubaker417

Can you provide the error log ?

Occhima avatar Sep 18 '22 00:09 Occhima