示例#1
0
    def execute(self, i, o):
        """
        Executes the command.

        :type i: cleo.inputs.input.Input
        :type o: cleo.outputs.output.Output
        """
        super(MigrateMakeCommand, self).execute(i, o)

        creator = MigrationCreator()

        name = i.get_argument('name')
        table = i.get_option('table')
        create = bool(i.get_option('create'))

        if not table and create is not False:
            table = create

        path = i.get_option('path')
        if path is None:
            path = self._get_migration_path()

        file_ = self._write_migration(creator, name, table, create, path)

        o.writeln(decode('<info>✓ Migration created successfully</info>'))
    def fire(self):
        """
        Executes the command.
        """
        creator = MigrationCreator()

        name = self.argument('name')
        table = self.option('table')
        create = bool(self.option('create'))

        if not table and create is not False:
            table = create

        path = self.option('path')
        if path is None:
            path = self._get_migration_path()

        self._write_migration(creator, name, table, create, path)

        self.info('<info>✓ Migration created successfully</info>')
示例#3
0
    def handle(self):
        """
        Executes the command.
        """
        creator = MigrationCreator()

        name = self.argument("name")
        table = self.option("table")
        create = bool(self.option("create"))

        if not table and create:
            table = create

        path = self.option("path")
        if path is None:
            path = self._get_migration_path()

        migration_name = self._write_migration(creator, name, table, create,
                                               path)

        self.line(f"<info>Created migration:</info> {migration_name}")
示例#4
0
    def handle(self):
        """
        Executes the command.
        """
        creator = MigrationCreator()

        name = self.argument('name')
        table = self.option('table')
        create = bool(self.option('create'))

        if not table and create is not False:
            table = create

        path = self.option('path')
        if path is None:
            path = self._get_migration_path()

        migration_name = self._write_migration(creator, name, table, create,
                                               path)

        self.line('<info>Created migration:</info> {}'.format(migration_name))
 def get_creator(self):
     return flexmock(MigrationCreator())