activerecord-sqlserver-adapter icon indicating copy to clipboard operation
activerecord-sqlserver-adapter copied to clipboard

Add some more niceties to the database tasks

Open bf4 opened this issue 4 years ago • 1 comments

bf4 avatar Apr 14 '21 16:04 bf4

I intend to get to it. Thanks for checking in.

On Thu, Jul 29, 2021, 7:48 AM Wanderson Policarpo @.***> wrote:

@.**** commented on this pull request.

In lib/active_record/tasks/sqlserver_database_tasks.rb https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/878#discussion_r679117600 :

     command.concat(table_args)
  •    view_args = connection.views.map { |v| Shellwords.escape(v) }
    
  •    view_args = connection.views.sort.map { |v| Shellwords.escape(v) }
    

This one is tricky. What if you have a view that depends on another view but alphabetical order does not match? Wouldn't that be a problem?

In lib/active_record/tasks/sqlserver_database_tasks.rb https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/878#discussion_r679117966 :

@@ -70,11 +70,14 @@ def structure_dump(filename, extra_flags) dump.gsub!(/^GO\n/, "") # Strip db GO statements dump.gsub!(/nvarchar(8000)/, "nvarchar(4000)") # Fix nvarchar(8000) column defs dump.gsub!(/nvarchar(-1)/, "nvarchar(max)") # Fix nvarchar(-1) column defs

  •    dump.gsub!(/varbinary\(-1\)/, "varbinary(max)")       # Fix varbinary(-1) column defs
    

Can you maybe add that test case?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/878#pullrequestreview-718048431, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABC4QTEARJFZBKDFZRINTLT2FEZDANCNFSM425WY7IQ .

bf4 avatar Jul 29 '21 13:07 bf4