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

Returns the versions of the migrations that have been run, oldest first.
Creates the 'ar_schema_migrations' table if it does not exist yet.
Records a migration version as run.
Forgets every migration version that has been run.
Removes a migration version from the list of the ones that have been run.
Drops the 'ar_schema_migrations' table.
Returns the versions of the migrations that have been run as numbers, oldest first.
Normalizes a version for storage and comparison: a string of digits.

Methods

ActiveRecord.SchemaMigration:all_versions()

shared packages/active_record/lib/migrator/schema_migration.lua:35

Returns 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:21

Creates 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:68

Records a migration version as run.

Parameters

  • version Number/String

ActiveRecord.SchemaMigration:delete_all_versions()

shared packages/active_record/lib/migrator/schema_migration.lua:90

Forgets every migration version that has been run.

ActiveRecord.SchemaMigration:delete_version(version)

shared packages/active_record/lib/migrator/schema_migration.lua:80

Removes 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:28

Drops the 'ar_schema_migrations' table.

ActiveRecord.SchemaMigration:integer_versions()

shared packages/active_record/lib/migrator/schema_migration.lua:56

Returns 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:16

Normalizes a version for storage and comparison: a string of digits.

Parameters

  • version Number/String

Returns

  • String

Defined in