Database migrations after the initial migration aren't being generated
The migration files are being generated, but the actual migration code has to be written manually.
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.
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?
Thanks, anachlas. The solution was to take the postgres server down, then do aqueduct setup -c and aqueduct db upgrade.
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 {
}
}
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.
Still waiting for awesome migration feature.
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.
Work is completed in #234. Waiting for 2.0.3 release.
Completed in 2.0.3.