New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added schema creation (postgres) if needed on first migration #4000
base: master
Are you sure you want to change the base?
Added schema creation (postgres) if needed on first migration #4000
Conversation
fix a problem with first migration when you don't have schema yet
I'd love to have this functionality as well. Unfortunately the commit broke the build but a conditional call of createSchemaIfNotExists based on if a schemaName exists should resolve the issue. |
Its working only with Postgres yet.. I will fix it and make PR again. |
@spanyukov Do you think you'll have time to update this PR? I don't mind opening a new PR if not. |
condtitional check for createSchemaIfNotExists
I added condition. |
Your changes unfortunately don't pass CI. You are probably better off appending the createSchemaIfNotExists to knex/lib/migrate/table-creator.js Line 70 in 9b82d06
Then the change only needs to happen in one place and that place is already "schema aware". Also there is docker-compose file if you want to run tests locally to verify your changes. |
create schema in schema builder getter
thanks! I put this code to schema builder getter as you described. |
fix a problem with first migration when you don't have schema yet.
Before you had a bug like this:
error: create table "config"."knex_migrations" ("id" serial primary key, "name" varchar(255), "batch" integer, "migration_time" timestamptz) - schema "config" does not exist