aqueduct icon indicating copy to clipboard operation
aqueduct copied to clipboard

Database migrations after the initial migration aren't being generated

Open anachlas opened this issue 10 years ago • 9 comments

The migration files are being generated, but the actual migration code has to be written manually.

anachlas avatar Nov 14 '16 19:11 anachlas

Is that why I get PostgreSQLSeverity.fatal 28000: role "dart" does not exist Detail: null Hint: null Table: null Column: null Constraint: null when I do aqueduct db upgrade? That's when I'm using OSX 10.11.6 and the Postgres.app. The 00000001_Initial.migration.dart generated by aqueduct db generate is identical to the one generated on another Mac with macOS 10.12.1 where the aqueduct db upgrade works fine.

jkleiser avatar Nov 16 '16 12:11 jkleiser

I don't believe so, it sounds like the dart user hasn't been created in your local database on the other machine. Have you run aqueduct setup on both machines?

anachlas avatar Nov 16 '16 12:11 anachlas

Thanks, anachlas. The solution was to take the postgres server down, then do aqueduct setup -c and aqueduct db upgrade.

jkleiser avatar Nov 16 '16 13:11 jkleiser

Yes. I reproduced this too.

I created a project with CLI and aqueduct db generate was ok for the first time and then i added some field and generate it again and all i get is...


class Migration2 extends Migration {
  Future upgrade() async {
  }

  Future downgrade() async {
  }
  Future seed() async {
  }
}

sclee15 avatar Mar 16 '17 08:03 sclee15

This is next on the list. All of the stuff to do it is there, just need to sew it all togethers and write the tests. Estimating it to be about two weeks from now. In the meantime, you can manually write the code in upgrade:

Future upgrade() async {
  database.addColumn("table", new SchemaColumn("fieldName", ManagedPropertyType.String));
}

See the API ref for SchemaBuilder, which is the type of database - a property all Migrations have.

Make sure to run aqueduct db validate. This ensures that all of the migration files will create the schema described by your ManagedObjects; it'll spit out every difference that it finds.

itsjoeconway avatar Mar 16 '17 15:03 itsjoeconway

Still waiting for awesome migration feature.

sclee15 avatar Apr 03 '17 04:04 sclee15

You can get early access to this feature by installing the CLI from the open branch. The branch has a few more tests that need to be written, so it may have errors, but it'd be good to get your feedback regardless.

On your local machine, clone this repository and switch the jc/migrate branch:

git clone https://github.com/stablekernel/aqueduct.git
cd aqueduct
git checkout jc/migrate

Then, while still inside this directory, activate this local copy in pub:

pub global activate -spath .

From there, you should be able to run aqueduct db generate in your project directory.

itsjoeconway avatar Apr 03 '17 15:04 itsjoeconway

Work is completed in #234. Waiting for 2.0.3 release.

itsjoeconway avatar Apr 25 '17 02:04 itsjoeconway

Completed in 2.0.3.

itsjoeconway avatar Apr 26 '17 14:04 itsjoeconway