Skip to content

Conversation

jasonmccreary
Copy link
Contributor

@jasonmccreary jasonmccreary commented Aug 25, 2017

This expands upon the recently added naming convention of create_XXX_table by also allowing the following convenient naming conventions:

  • drop_XXX_table
  • rename_XXX_to_YYY
  • add_CCC_to_XXX
  • remove_CCC_from_XXX
  • rename_CCC_to_DDD_in_XXX

The _table suffix is optional. If provided it will remain in the migration and class names, but automatically removed from the table name.

I'll admit this implementation is naive. I took care to minimize impact on existing classes and methods. However, if well received by the community, the code could be greatly streamlined by removing the table and create options and refining these conventions to support column data types.

This also includes a small change to allow the developer to use a StudlyCase migration name in an effort to unify conventions with other artisan commands.

@tillkruss tillkruss changed the title Make migration from convenient naming conventions [5.5] Make migration from convenient naming conventions Aug 26, 2017
@DanielCoulbourne
Copy link
Contributor

I love how you snuck the StudlyCase thing into this PR. 👍 all around.

@GrahamCampbell GrahamCampbell changed the base branch from master to 5.5 August 30, 2017 19:49
@LasseRafn
Copy link
Contributor

👍🏻


/**
* Ensure that a migration with the given name doesn't already exist.
* Ensure that a migration with the given name does not already exist.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this line?

Copy link

@MarkVaughn MarkVaughn Oct 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because typically contractions are used in conversational English and avoided in formal writing. But it's not a big deal, seems like a nit-picky thing to do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never met a technical writer that dislikes contractions being used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if that were the case, why change it in this PR? Make a separate PR for it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He wrote and rewrote a bunch of comments in this PR. Are you seriously that offended by it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not saying it's right or wrong. Nor that it needs to be changed or not. I was simply adding to the idea of "formal writing" that I have yet (in like 6 years of working with technical writers) met one that dislikes their use. Which means, it can't be that informal if few who write professionally in the tech industry seems to really care in either direction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not offended by anything? I'm just saying it's a useless change and not really in the scope of this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a trivial change. Honestly one that was either automated by my IDE or I did inadvertently when reviewing comments. Glad to revert it if additional changes are required for this PR.

@fabiolrs
Copy link

fabiolrs commented Dec 8, 2017

@jasonmccreary

Would it be ok if I created some code for renaming/dropping/etc foreign keys and indexes? I have hundreds of migrations that do that and having something like remove_fk_AAA_from_BBB and rename_index_999_to_index_888_in_XXX would be nice.

@jasonmccreary
Copy link
Contributor Author

@fabiolrs For sure.

However, given the delay in merging this - I may break this out into its own package. If this gets merged into core, great. If not, then a package seems a good direction.

@GrahamCampbell GrahamCampbell changed the title [5.5] Make migration from convenient naming conventions [5.6] Make migration from convenient naming conventions Dec 30, 2017
@GrahamCampbell GrahamCampbell changed the base branch from 5.5 to master December 30, 2017 13:47
@GrahamCampbell GrahamCampbell changed the base branch from master to 5.6 December 31, 2017 17:19
@taylorotwell
Copy link
Member

I don't think I want to maintain this in the core.

@m1guelpf
Copy link
Contributor

m1guelpf commented Jan 5, 2018

@jasonmccreary Did you end up creating that package?

@jasonmccreary
Copy link
Contributor Author

It would seem these new additions have ended up in no mans land.

To @taylorotwell's point, they understandably bring too much overhead to core.

However, given their nature - leveraging the core make:migration command - I worry they won't have as much value as a separate command/package.

I may see if they are welcome additions to @JeffreyWay's generators package.

Either way, I have opened #22648 with hopes the StudlyCase change may still bring value to core.

@jasonmccreary jasonmccreary deleted the migrations branch January 5, 2018 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants