i rails uses timestamps in migration filenames. how utilize determine migrations have been run far , still needs run? there value stored somewhere lets know last migration run?
in database, there's table called schema_migrations
keeps track of it. it's maintained automatically rails, , has single column called version
. column holds date-time stamp of migration, , each row represents migration that's been run.
so, rails can @ 'migration' files in app, figure out ones not yet have corresponding row in schema_migrations
table, , run them (adding new row schema migrations table, each migration, runs)
here's example of content of schema_migrations
table.