conduit-dart / conduit

Dart HTTP server framework for building REST APIs. Includes PostgreSQL ORM and OAuth2 provider.
https://theconduit.dev
BSD 2-Clause "Simplified" License
448 stars 44 forks source link

[BUG] Migration class with docstring fails to execute. #213

Open jeffscaturro-aka opened 10 months ago

jeffscaturro-aka commented 10 months ago

Describe the bug

If I add a migration file, and then add a docstring to that migration, it fails to run the migration and bombs out with the following error:

Applying local migrations...
-- Conduit CLI Version: 4.4.0
-- Conduit project version: 4.4.0
*** Uncaught error
    RangeError (start): Invalid value: Not in inclusive range 0..281: 499
  **** Stacktrace
  * #0      RangeError.checkValidRange (dart:core/errors.dart:360:7)
  * #1      _StringBase.substring (dart:core-patch/string_patch.dart:398:27)
  * #2      new MigrationSource (package:conduit/src/migration_source.dart:8:28)
  * #3      new MigrationSource.fromFile (package:conduit/src/migration_source.dart:32:12)
  * #4      CLIDatabaseManagingCommand.projectMigrations.<anonymous closure> (package:conduit/src/mixins/database_managing.dart:36:41)
  * #5      MappedIterator.moveNext (dart:_internal/iterable.dart:393:20)
  * #6      new _GrowableList._ofOther (dart:core-patch/growable_array.dart:202:26)
  * #7      new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
  * #8      new List.of (dart:core-patch/array_patch.dart:47:28)
  * #9      Iterable.toList (dart:core/iterable.dart:495:7)
  * #10     CLIDatabaseManagingCommand.projectMigrations (package:conduit/src/mixins/database_managing.dart:37:12)
  * #11     CLIDatabaseUpgrade.handle (package:conduit/src/commands/db_upgrade.dart:18:24)
  * #12     CLICommand.process (package:conduit/src/command.dart:238:20)
  * <asynchronous suspension>
  * #13     main (file:///Users/jeff/.pub-cache/hosted/pub.dev/conduit-4.4.0/bin/conduit.dart:9:14)
  * <asynchronous suspension>
  ****

To Reproduce Steps to reproduce the behavior:

  1. Make a change that would result in a migration file being added, or add your own migration file.
  2. Add a docstring to migration class (/// This migration was added because... for class Migration13 extends Migration {).
  3. Run the migrations.
  4. See error.
  5. Remove the docstring from the migration class.
  6. Run the migration.

Expected behavior

I would expect to be able to add a docstring to an added migration.

Screenshots If applicable, add screenshots to help explain your problem.

System Information: