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

support stored procedures in SQLServerDatabaseTasks#structure_dump

Open jonahgeorge opened this issue 4 years ago • 0 comments

Currently, SQLServerDatabaseTasks#structure_dump supports exporting tables and views; however, the underlying tool defncopy supports stored procedures as well. It would be particularly helpful to export stored procedures from an existing database, especially when activerecord-sqlserver-adapter already supports running them.

My current understanding is that SchemaStatements would need to be extended to return stored procedures (like tables and views on the underlying ActiveRecord connection). A query like the following may suffice:

SELECT distinct routine_schema, routine_name
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE = 'PROCEDURE';

Related:

  • https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/944

jonahgeorge avatar Nov 21 '21 19:11 jonahgeorge