only mysql

atlas migrate hash

# There will be an implicit commit in MySQL, leaving this file partially applied.
! atlas migrate apply --url URL
stderr 'executing statement "THIS IS A FAILING STATEMENT;" from version "3"'

# Status will tell us about partial appliance.
atlas migrate status --url URL
stdout 'Migration Status: PENDING'
stdout '  -- Current Version: 3 \(1 statements applied\)'
stdout '  -- Next Version:    3 \(1 statements left\)'
stdout '  -- Executed Files:  1 \(last one partially\)'
stdout '  -- Pending Files:   1'
stdout ''
stdout 'Last migration attempt had errors:'
stdout '  -- SQL:   THIS IS A FAILING STATEMENT;'

# Running apply again with fixed file will solve it, only running the missing statement.
cp 3_checkpoint.sql migrations/3_checkpoint.sql
atlas migrate hash
atlas migrate apply --url URL
stdout 'Migrating to version 3 from 3 \(1 migrations in total\):'
stdout ''
stdout '  -- migrating version 3'
stdout '    -> CREATE TABLE `tbl_2` \(`col` bigint\);'
stdout '  -- ok'

atlas migrate apply --url URL
stdout 'No migration files to execute'

-- migrations/1_first.sql --
CREATE TABLE `tbl_1` (`col` bigint);

-- migrations/2_second.sql --
CREATE TABLE `tbl_2` (`col` bigint);

-- migrations/3_checkpoint.sql --
-- atlas:checkpoint

CREATE TABLE `tbl_1` (`col` bigint);
THIS IS A FAILING STATEMENT;

-- 3_checkpoint.sql --
-- atlas:checkpoint

CREATE TABLE `tbl_1` (`col` bigint);
CREATE TABLE `tbl_2` (`col` bigint);

