Skip to content
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

Add deferrable support for constraint #4584

Merged
merged 13 commits into from Jul 25, 2021
Merged

Conversation

zeotuan
Copy link
Contributor

@zeotuan zeotuan commented Jul 23, 2021

Address #4292 : Add Deferrable Support

  • Foreign: deferrable([deferrable]) can be chained off table.foreign() or column.references()
  • allow option object to be used for primary/unique:
    column.unique(indexName | options={[indexName: string], [deferrable: string]});
    table.unique(columns,indexName | options={[indexName: string], [deferrable: string]});
    column.primary(constraintName | options={[constraintName : string], [deferrable: string]});
    table.primary(columns,constraintName | options={[constraintName : string], [deferrable: string]});

@zeotuan zeotuan marked this pull request as ready for review July 24, 2021 02:39
@zeotuan
Copy link
Contributor Author

zeotuan commented Jul 24, 2021

@kibertoad this test seem to be flaky:

       postgresql | pg
         knex.migrate.latest in parallel
           is not able to run two migrations in parallel when transactions are disabled:

      AssertionError: expected false to equal true
      + expected - actual

      -false
      +true
      
      at /home/runner/work/knex/knex/test/integration/migrate/migration-integration-tests.js:789:33
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)```

@@ -86,14 +87,20 @@ class TableCompiler_Oracle extends TableCompiler {
);
}

primary(columns, constraintName) {
primary(columns, constraintName, deferrable) {
if (isObject(columns) && !(columns instanceof Array)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think idiomatic JS way is Array.isArray()

@zeotuan zeotuan requested a review from kibertoad July 24, 2021 16:14
@kibertoad
Copy link
Collaborator

Great job! Could you also create doc PR at https://github.com/knex/documentation?

@zeotuan
Copy link
Contributor Author

zeotuan commented Jul 25, 2021

Great job! Could you also create doc PR at https://github.com/knex/documentation?

Documentation added. Can you check it out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants