luckyframework / luckyframework/avram
Should we require "avram/src/lucky/tasks/gen/model" as default?
Nobody has claimed this yet.
- Dominant language
- Crystal
- Stars
- 183
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
I consider following gen.model task is a key component of avram, right?
▸ gen.model Generate a model, query, and operations (save and delete)
I add lucky binary to my $PATH for my current laptop login user, yes, it serve as a common command for all my avram project.
When i running `lucky --help` on my project which use 1.0.0-rc1 avram, there is no gen.model task.
For now, i have to `require "avram/src/lucky/tasks/gen/model"` manually in tasks.cr to make this task available
```crystal
# See `LuckyEnv#task?`
ENV["LUCKY_TASK"] = "true"
require "./src/config/database"
require "avram/src/lucky/tasks/gen/model"
require "lucky_task"
require "./tasks/**"
LuckyTask::Runner.run
```
```sh
╰─ $ lucky --help
Usage: lucky name.of.task [options]
Available tasks:
▸ db.console Access PostgreSQL console
▸ db.create Create the database
▸ db.drop Drop the database
▸ db.migrate Run any pending migrations
▸ db.migrate.one Run just the next pending migration
▸ db.migrations.status Print the current status of migrations
▸ db.redo Rollback and run just the last migration
▸ db.reset Drop, recreate, and run migrations.
▸ db.rollback Rollback the last migration
▸ db.rollback_all Rollback all migrations
▸ db.rollback_to Rollback to a specific migration
▸ db.schema.dump Export database schema to a sql file
▸ db.schema.restore Restore database from a sql dump file
▸ db.seed.required_data Add database records required for the app to work
▸ db.seed.sample_data Add sample database records helpful for development
▸ db.setup Runs a few tasks for setting up your database
▸ db.verify_connection Verify connection to postgres
▸ gen.migration Generate a new migration
▸ gen.model Generate a model, query, and operations (save and delete)
```
I consider this is not necessory, right?
I test on avram 1.0.0-rc1 with lucky-cli 1.0.0-rc1 binary but without add lucky as project dependency.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with avram/src/lucky/tasks/gen/model and the tasks.cr example, then compare how the existing db.* and gen.migration tasks become available to lucky --help. Confirm whether gen.model should be loaded by default when Avram is used without Lucky as a project dependency, and verify the task appears without the manual require.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100