ActiveRecord.SchemaMigration class
Part of Active Record
Keeps track of the migrations that have been run. Their versions are stored in the 'ar_schema_migrations' table, one row each: the migrator reads them to tell the pending migrations from the ones that have been run, and adds or removes a row whenever a migration is run or reverted. The class is used as it is, without creating objects of it.
Summary
Methods
Methods
ActiveRecord.SchemaMigration:all_versions()
shared packages/active_record/lib/migrator/schema_migration.lua:35Returns the versions of the migrations that have been run, oldest first. Has to be called while the adapter is in sync mode.
Returns
- List<String>
ActiveRecord.SchemaMigration:create_table()
shared packages/active_record/lib/migrator/schema_migration.lua:21Creates the 'ar_schema_migrations' table if it does not exist yet.
ActiveRecord.SchemaMigration:create_version(version)
shared packages/active_record/lib/migrator/schema_migration.lua:68Records a migration version as run.
Parameters
- version Number/String
ActiveRecord.SchemaMigration:delete_all_versions()
shared packages/active_record/lib/migrator/schema_migration.lua:90Forgets every migration version that has been run.
ActiveRecord.SchemaMigration:delete_version(version)
shared packages/active_record/lib/migrator/schema_migration.lua:80Removes a migration version from the list of the ones that have been run.
Parameters
- version Number/String
ActiveRecord.SchemaMigration:drop_table()
shared packages/active_record/lib/migrator/schema_migration.lua:28Drops the 'ar_schema_migrations' table.
ActiveRecord.SchemaMigration:integer_versions()
shared packages/active_record/lib/migrator/schema_migration.lua:56Returns the versions of the migrations that have been run as numbers, oldest first.
Returns
- List<Number>
ActiveRecord.SchemaMigration:normalize_migration_number(version)
shared packages/active_record/lib/migrator/schema_migration.lua:16Normalizes a version for storage and comparison: a string of digits.
Parameters
- version Number/String
Returns
- String