Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ class DBMigrateCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
import asyncio

return asyncio.run(self.handle_async())
asyncio.run(self.handle_async())
return 0

async def handle_async(self):
self.confirm_to_proceed()
Expand Down Expand Up @@ -72,7 +73,7 @@ def resolve_migration_path(self) -> str:
default_directory = config.get("directory")

migration_directory = path or default_directory
return self.container.use_base_path(migration_directory)
return str(self.container.use_base_path(migration_directory))

def confirm_to_proceed(self) -> None:
# prompt user for confirmation in production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ class DBSeedCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
import asyncio

return asyncio.run(self.handle_async())
asyncio.run(self.handle_async())
return 0

async def handle_async(self):
from ..seeders import Seeder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MakeMigrationCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
name = self.argument("name").replace("-", "_")
now = datetime.datetime.today()

Expand Down Expand Up @@ -60,3 +60,4 @@ def handle(self):
fp.write(output)

self.info(f"Migration file created: {os.path.join(migration_directory, file_name)}")
return 0
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MakeModelCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
name = self.argument("name")

model_directory = self.option("directory")
Expand All @@ -73,7 +73,7 @@ def handle(self):

if os.path.exists(os.path.join(full_directory_path, file_name)):
self.line(f'<error>Model "{name}" Already Exists ({full_directory_path}/{file_name})</error>')
return
return 0

os.makedirs(os.path.dirname(os.path.join(full_directory_path)), exist_ok=True)

Expand All @@ -97,3 +97,5 @@ def handle(self):
if self.option("seeder"):
directory = self.option("seeders-directory")
self.call("seed", f"{self.argument('name')} --directory {directory}")

return 0
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MakeSeedCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
# get the contents of a stub file
# replace the placeholders of a stub file
# output the content to a file location
Expand All @@ -46,9 +46,11 @@ def handle(self):
path_normalized = pathlib.Path(seed_directory) / pathlib.Path(file_name)

if os.path.exists(full_path):
return self.line(f"<error>{path_normalized} already exists.</error>")
self.line(f"<error>{path_normalized} already exists.</error>")
return 0

with open(full_path, "w") as fp:
fp.write(output)

self.info(f"Seed file created: {path_normalized}")
return 0
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ class MigrateFreshCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
import asyncio

return asyncio.run(self.handle_async())
asyncio.run(self.handle_async())
return 0

async def handle_async(self):
directory = self.resolve_migration_path()
Expand Down Expand Up @@ -78,4 +79,4 @@ def resolve_migration_path(self) -> str:
default_directory = config.get("directory")

migration_directory = path or default_directory
return self.container.use_base_path(migration_directory)
return str(self.container.use_base_path(migration_directory))
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ class MigrateRefreshCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
import asyncio

return asyncio.run(self.handle_async())
asyncio.run(self.handle_async())
return 0

async def handle_async(self):
directory = self.resolve_migration_path()
Expand Down Expand Up @@ -79,4 +80,4 @@ def resolve_migration_path(self) -> str:
default_directory = config.get("directory")

migration_directory = path or default_directory
return self.container.use_base_path(migration_directory)
return str(self.container.use_base_path(migration_directory))
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class MigrateResetCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
import asyncio

return asyncio.run(self.handle_async())
asyncio.run(self.handle_async())
return 0

async def handle_async(self):
directory = self.resolve_migration_path()
Expand All @@ -54,4 +55,4 @@ def resolve_migration_path(self) -> str:
default_directory = config.get("directory")

migration_directory = path or default_directory
return self.container.use_base_path(migration_directory)
return str(self.container.use_base_path(migration_directory))
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class MigrateRollbackCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
import asyncio

return asyncio.run(self.handle_async())
asyncio.run(self.handle_async())
return 0

async def handle_async(self):
directory = self.resolve_migration_path()
Expand All @@ -54,4 +55,4 @@ def resolve_migration_path(self) -> str:
default_directory = config.get("directory")

migration_directory = path or default_directory
return self.container.use_base_path(migration_directory)
return str(self.container.use_base_path(migration_directory))
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ class MigrateStatusCommand(Command):
),
]

def handle(self):
def handle(self) -> int:
import asyncio

return asyncio.run(self.handle_async())
asyncio.run(self.handle_async())
return 0

async def handle_async(self):
directory = self.resolve_migration_path()
Expand Down Expand Up @@ -77,4 +78,4 @@ def resolve_migration_path(self) -> str:
default_directory = config.get("directory")

migration_directory = path or default_directory
return self.container.use_base_path(migration_directory)
return str(self.container.use_base_path(migration_directory))
Loading