internal Migration(string filePath, Regex commandSplitter)
        {
            var sql = File.ReadAllText(filePath, Encoding.GetEncoding("iso-8859-1"));

            SqlCommands = commandSplitter.Split(sql).Where(s => s.Trim().Length > 0).ToList();
            Hash        = GetHash(sql);
            Filename    = Path.GetFileName(filePath);

            UseTransaction = !sql.StartsWith(NoTransactionToken);

            // check if the migration includes another file
            IList <string> includedRelativeFilepaths = null;

            try
            {
                includedRelativeFilepaths = GetRelativeIncludedFilepaths(sql);
            }
            catch (Exception ex)
            {
                throw new Exception($"Error processing the migration '{Filename}'", ex);
            }

            if (includedRelativeFilepaths.Count > 0)
            {
                SqlCommands.Clear();
                var fileDirectory = Path.GetFullPath(Path.GetDirectoryName(filePath));

                foreach (var includedRelativeFilepath in includedRelativeFilepaths)
                {
                    IncludedFilepath = Path.GetFullPath(Path.Combine(fileDirectory, includedRelativeFilepath));
                    // check if the included file is under the migration's folder
                    if (!CheckIncludedFilepath(fileDirectory, IncludedFilepath))
                    {
                        throw new Exception(
                                  $"The migration '{Filename}' tries to include a file that is not relative to the migration's " +
                                  $"folder: '{IncludedFilepath}'");
                    }

                    // read the included file
                    if (File.Exists(IncludedFilepath))
                    {
                        sql = File.ReadAllText(IncludedFilepath, Encoding.GetEncoding("iso-8859-1"));
                        SqlCommands.AddRange(commandSplitter.Split(sql).Where(s => s.Trim().Length > 0));
                    }
                    else
                    {
                        throw new Exception(
                                  $"The migration '{Filename}' tries to include a file that does not exist: {IncludedFilepath}");
                    }
                }
            }
        }