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

Default values #45

Closed
roytz opened this issue May 2, 2017 · 2 comments · May be fixed by #104
Closed

Default values #45

roytz opened this issue May 2, 2017 · 2 comments · May be fixed by #104

Comments

@roytz
Copy link

roytz commented May 2, 2017

Hi,
I have a schema that uses the uuid-ossp extension in order to generate uuid as default value -

CREATE TABLE IF NOT EXISTS public."SomeTable"
(
    id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    ...
)

but the generated model I get is with no default value settings.
I also use empty array as default on some schemas but it also not generated into the model created by pg-generator.
Am I missing something?

Thank you!

@andresmeidla
Copy link

Got the same problem,
worked around it with defining custom attribute with the datafile option "--datafile custom.js"
custom.js

// template customizations
const customers = {
    attributes: {
        id: {
            default: 'DataTypes.UUIDV4'
        }
    }
};

var custom = {
    Customer: customers
}

module.exports = custom;

@ozum
Copy link
Owner

ozum commented Jun 18, 2017

Currently, extension support is limited (read: non exists). You may use @andresmeidla's workaround.

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 a pull request may close this issue.

3 participants