Skip to content

Conversation

@Envek
Copy link
Contributor

@Envek Envek commented Jul 19, 2014

This allows to specify a type for created foreign key column in references and add_reference in migrations, very handy:

def change
  enable_extension 'uuid-ossp'
  create_table :cars, id: :uuid do |t|
    t.integer :seats
    # And other car-specific things
  end
  create_table :wheels do |t|
    t.references :car, type: :uuid, index: true
    t.integer :radius
    # And other wheel-specific things
  end
end

Also I've changed PostgreSQL test to use this shiny functionality (looks better, eh?). And if anyone will ever remove this (not by reverting this PR), test will fail, showing that folks that use Postgres really need it ;-)

Bonus: documentation for references method.

P.S> After I wrote this PR I've found PR #13959 (which does the same, but little bit lengthy). Also see it for previous discussion. Choose either you like, I'll be happy with any of these PRs merged.

Will close #13959 if merged.

@senny senny changed the title Allow to specify a type for foreign key column in migrations Allow to specify a type for references in migrations Jul 21, 2014
Copy link
Member

Choose a reason for hiding this comment

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

can you add Example: above this line? See other entries for the general style.

@senny
Copy link
Member

senny commented Jul 22, 2014

Can you add the following to the commit message:

[Łukasz Sarnacki & Novikov Andrey]

This will credit both authors for the patch.

Copy link
Member

Choose a reason for hiding this comment

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

Any specific reason for this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, just followed other tests in this file…

@senny
Copy link
Member

senny commented Jul 22, 2014

@Envek added a couple minor comments. This patch looks good. Let me know when you updated the code.

@Envek
Copy link
Contributor Author

Envek commented Jul 22, 2014

Updated code, squashed, and rebased on top of current master.

@senny senny merged commit 6d327db into rails:master Jul 22, 2014
senny added a commit that referenced this pull request Jul 22, 2014
* Allow to specify a type for foreign key column in migrations
* unified the docs
* some cleanup in CHANGELOG
@senny
Copy link
Member

senny commented Jul 22, 2014

@Envek modified the docs and the CHANGELOG slightly.

@lukesarnacki , @Envek thank you for your work 💛

@Envek Envek deleted the type_in_references branch July 23, 2014 09:12
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.

2 participants