Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add Change Column Default Macro

  • Loading branch information...
commit 0ac66731ea9a010327a8c6738cc00a4f96dfcfaf 1 parent a819588
@brianjlandau brianjlandau authored
View
44 Macros/Change Column Default.tmMacro
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>commands</key>
+ <array>
+ <dict>
+ <key>command</key>
+ <string>deleteWordLeft:</string>
+ </dict>
+ <dict>
+ <key>command</key>
+ <string>moveToBeginningOfLine:</string>
+ </dict>
+ <dict>
+ <key>command</key>
+ <string>moveToEndOfDocumentAndModifySelection:</string>
+ </dict>
+ <dict>
+ <key>argument</key>
+ <dict>
+ <key>command</key>
+ <string>intelligent_migration_snippet.rb change_column_default</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ </dict>
+ <key>command</key>
+ <string>executeCommandWithOptions:</string>
+ </dict>
+ </array>
+ <key>name</key>
+ <string>Change Column Default</string>
+ <key>scope</key>
+ <string>meta.rails.migration - meta.rails.migration.create_table - meta.rails.migration.change_table</string>
+ <key>scopeType</key>
+ <string>local</string>
+ <key>tabTrigger</key>
+ <string>mcol</string>
+ <key>uuid</key>
+ <string>A219EBB8-004A-4012-B5B2-232C9A5C94F8</string>
+</dict>
+</plist>
View
4 Support/bin/intelligent_migration_snippet.rb
@@ -28,6 +28,10 @@
'change_column' =>
{ :up => 'change_column :${1:table_name}, :${2:column_name}, :${4:string}$5',
:down => 'change_column :$1, :$2, :${6:string}$7' },
+
+ 'change_column_default' =>
+ { :up => 'change_column_default :${1:table_name}, :${2:column_name}, ${4:"${5:new default}"}',
+ :down => 'change_column_default :$1, :$2, ${6:"${7:old default}"}' },
'add_remove_column' =>
{ :up => 'add_column :${1:table_name}, :${2:column_name}, :${3:string}$0',
View
2  info.plist
@@ -353,6 +353,7 @@
<string>27A6C58A-896B-4956-BA81-D671A2EF9C7D</string>
<string>221969A1-A5EA-4A8E-8817-C74EBED63901</string>
<string>42DE1441-D1B7-4998-BAF9-16B1EC7E210C</string>
+ <string>A219EBB8-004A-4012-B5B2-232C9A5C94F8</string>
<string>AC50762C-DE40-4EB9-9A22-2F6AF2EA4EA3</string>
<string>F03162DE-9DB6-417B-9DD7-52D9F11EA736</string>
<string>04A86178-71B1-430A-A06D-DFF7C9A338B5</string>
@@ -686,6 +687,7 @@
<string>04A86178-71B1-430A-A06D-DFF7C9A338B5</string>
<string>FD8CC811-2AD3-480F-B975-DF959DC96C67</string>
<string>42DE1441-D1B7-4998-BAF9-16B1EC7E210C</string>
+ <string>A219EBB8-004A-4012-B5B2-232C9A5C94F8</string>
<string>95F83E1D-5B03-424F-8BEC-8AF66C8939BC</string>
<string>33057A79-677B-4DFB-99D4-1492778BDDC6</string>
<string>A7F692C1-778A-48B8-945E-573568BA0403</string>
Please sign in to comment.
Something went wrong with that request. Please try again.