luckyframework / luckyframework/avram

Add #seed method to factory?

Open
#783 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

related to https://github.com/luckyframework/lucky_cli/issues/677

I have a feature flagging system in my app which allows me to ask "can a user do X?", each feature is stored in the database and can be enabled on a per-user or system wide basis. When I add a feature to the code, the answer is always "no" until I add the feature record to the database. In production this means shelling into the database and manually inserting a record! 🔥 ↔️ 🚒

Adding a #seed method to Factory might make this easier if it:

- assembles a list of attributes which are set by the factory.create block
- checks for a matching record and returns it if it exists
- delegates to #create if it doesn't exist.

Is that worth doing?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing related issue 677 and the existing Factory API. Determine how a seed operation should assemble attributes from a factory.create block, find a matching record, and delegate to create when none exists; done means this behavior is agreed and covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.