SchemaPlus / schema_plus_views

Provides support for creating and dropping views in ActiveRecord migrations. Also support for querying views.
MIT License
28 stars 16 forks source link

Allow for the "OR REPLACE" syntax on Postgres. #4

Closed hcarver closed 9 years ago

hcarver commented 9 years ago

Allow for the option to replace a view, not just create one.

coveralls commented 9 years ago

Coverage Status

Coverage decreased (-0.99%) to 99.01% when pulling 307307dbb1a90ff385bb28037f4e1628d8c8589f on hcarver:master into 5be4f139a41d1287181afcbe4ba2f3e02efc6528 on SchemaPlus:master.

ronen commented 9 years ago

@hcarver thanks for the PR -- I like adding the functionality.

But I'm not fond of implementing it by duplicating the complete add_view method with all its logic in the postgresql adapter... that'll just make it harder to maintain (especially if somebody else comes along later with another option to add, such as :temporary).

And in any case MySQL also supports CREATE OR REPLACE. So I'd suggest just adding the option to the method in abstract_adapter.rb (See also my comment on the commit itself.)

Also could you add a spec that tests this (skipping sqlite3 since it doesn't support it) and, and add documentation to the README?

Thanks! Sorry for the extra work for what doubtless seemed like quick small thing...