visual studio - Sort output of Get-Migrations ascending? -


by default, get-migrations command, when run in visual studio package manager console, returns list of entity framework migrations have been applied target database in descending order. is, list sorted have recent migrations first.

is there way make get-migrations return list of migrations in ascending order, is, oldest migrations first, instead?

what i've tried far:

  • piped output sort-object cmdlet, e.g. get-migrations [my params] | sort-object -property name (i'm not sure property name specify, or if applicable?). of these attempts silently failed (no error message displayed, no change in get-migrations output).

  • looked @ powershell get-migrations (get-help get-migrations) , searched web see if get-migrations has parameter controls output sort order. couldn't find one.

output of get-migrations command i'm getting:

pm> get-migrations [my arguments...] retrieving migrations have been applied target database. 201704121534436_somemigration999 201703291334212_somemigration998 [lots , lots more records here pain scroll through...] 201410110448547_initializetables 201410110018266_initialcreate 

based on provided sample output seems command returns text.

i'd split on linebreaks, , on _ 2 properties separated, able sort things afterwards:

#$migrations = get-migrations "..."  #test values $migrations = "201704121534436_somemigration999 201703291334212_somemigration998 201410110448547_initializetables 201410110018266_initialcreate"  $migrations.split("`n") | foreach-object {     new-object -typename psobject -property @{         date = $_.split("_")[0]         name = $_.split("_")[1]     } } | sort-object name 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -