Determining the version from the database

How would you determine the current version of discourse within the database?

1 Like

Find the most recent entry in the migrations table.

4 Likes

Example


select table_name from information_schema.tables where table_schema = 'public' and table_name like 'schema%' order by table_name ;
        table_name        
--------------------------
 schema_migration_details
 schema_migrations
 
 select version from schema_migrations order by version desc limit 1 ;
     version     
 ----------------
  20200203061927
  
  discourse=# select version, name, git_version, rails_version from schema_migration_details where version in ( select version from schema_migrations order by version desc limit 10 ) order by version desc ;
      version     |                      name                       |               git_version                | rails_version 
  ----------------+-------------------------------------------------+------------------------------------------+---------------
   20200203061927 | MarkBookmarksTopicIdNotNull                     | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200130115859 | RemoveBounceScoreThresholdDeactivateSiteSetting | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200121120800 | CorrectUserNotesCount                           | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200120140900 | AddUserNotesCountIndex                          | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200120131338 | DropUnusedColumns                               | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200117174646 | MakePostReplyIdColumnReadOnly                   | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200117172135 | AddTriggerToSyncPostReplies                     | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200117141138 | UpdatePostReplyIndexes                          | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200116140132 | RenameReplyIdColumn                             | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
   20200109130028 | UpdateUserProfilesIndexes                       | 31f3ed8d3610b63c7b1146e1a67ee51b703dbc41 | 6.0.1
  (10 rows)
  
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.