A way to add functions like addTimeStamps
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
something like:
$table->addMethod('addUserIds', function($table) {
$table->addColumn('created_by', 'integer', ['unsigned' => true, 'null' => true])
->addColumn('updated_by', 'integer', ['unsigned' => true, 'null' => true])
->addColumn('deleted_by', 'integer', ['unsigned' => true, 'null' => true]);
});
Then you could:
$table->addTimestamps()->addUserIds()->create();
Or any number of standardized columns. Is there a way to do this already that maybe I have overlooked? I have considered extending the AbstractMigration class but I'm not sure that would get me there.
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
Review the existing migration and table APIs, including AbstractMigration, to determine whether custom chained methods such as addUserIds can already be defined. Compare that behavior with the proposed addMethod example and document or implement a supported way to add standardized column helpers; done means the example can be used during a migration without duplicating the column definitions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100