Skip to content

Instantly share code, notes, and snippets.

@JoseMPena
Created November 11, 2020 10:20
Show Gist options
  • Save JoseMPena/a3b389d363e18e93f5ec48e241c5e3fe to your computer and use it in GitHub Desktop.
Save JoseMPena/a3b389d363e18e93f5ec48e241c5e3fe to your computer and use it in GitHub Desktop.
Using rails console to manipulate schema
2.3.1 :001 > class SchemaMigration < ActiveRecord::Base; self.primary_key = :version; end
=> :version
class SchemaMigration < ActiveRecord::Base; self.primary_key = :version; end
2.3.1 :002 > SchemaMigration.first
SchemaMigration Load (2.1ms) SELECT "schema_migrations".* FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC LIMIT 1
=> #<SchemaMigration version: "20160727113335">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment