Search in sources :

Example 1 with CreateDomainDefaultStep

use of org.jooq.CreateDomainDefaultStep in project jOOQ by jOOQ.

the class DDL method createDomain.

@SuppressWarnings({ "rawtypes", "unchecked" })
final Query createDomain(Domain<?> domain) {
    CreateDomainAsStep s1 = configuration.createDomainIfNotExists() ? ctx.createDomainIfNotExists(domain) : ctx.createDomain(domain);
    CreateDomainDefaultStep s2 = s1.as(domain.getDataType());
    CreateDomainConstraintStep s3 = domain.getDataType().defaulted() ? s2.default_(domain.getDataType().default_()) : s2;
    if (domain.getChecks().isEmpty())
        return s3;
    return s3.constraints(map(domain.getChecks(), c -> c.constraint()));
}
Also used : UniqueKey(org.jooq.UniqueKey) Arrays(java.util.Arrays) Tools.map(org.jooq.impl.Tools.map) KEY_COMP(org.jooq.impl.Comparators.KEY_COMP) Table(org.jooq.Table) SCHEMA(org.jooq.DDLFlag.SCHEMA) SEQUENCE(org.jooq.DDLFlag.SEQUENCE) CreateTableOnCommitStep(org.jooq.CreateTableOnCommitStep) Arrays.asList(java.util.Arrays.asList) Index(org.jooq.Index) DSLContext(org.jooq.DSLContext) Domain(org.jooq.Domain) COMMENT(org.jooq.DDLFlag.COMMENT) DSL.constraint(org.jooq.impl.DSL.constraint) CHECK(org.jooq.DDLFlag.CHECK) Collection(java.util.Collection) Check(org.jooq.Check) Field(org.jooq.Field) Meta(org.jooq.Meta) DOMAIN(org.jooq.DDLFlag.DOMAIN) TableType(org.jooq.TableOptions.TableType) List(java.util.List) Queries(org.jooq.Queries) CreateIndexIncludeStep(org.jooq.CreateIndexIncludeStep) Query(org.jooq.Query) TABLE(org.jooq.DDLFlag.TABLE) ForeignKey(org.jooq.ForeignKey) VIEW(org.jooq.TableOptions.TableType.VIEW) UNIQUE(org.jooq.DDLFlag.UNIQUE) Sequence(org.jooq.Sequence) ArrayList(java.util.ArrayList) CreateViewAsStep(org.jooq.CreateViewAsStep) INDEX(org.jooq.DDLFlag.INDEX) Comment(org.jooq.Comment) Schema(org.jooq.Schema) PRIMARY_KEY(org.jooq.DDLFlag.PRIMARY_KEY) FOREIGN_KEY(org.jooq.DDLFlag.FOREIGN_KEY) NAMED_COMP(org.jooq.impl.Comparators.NAMED_COMP) CreateDomainAsStep(org.jooq.CreateDomainAsStep) DDLFlag(org.jooq.DDLFlag) DDLExportConfiguration(org.jooq.DDLExportConfiguration) OnCommit(org.jooq.TableOptions.OnCommit) CreateSequenceFlagsStep(org.jooq.CreateSequenceFlagsStep) StringUtils(org.jooq.tools.StringUtils) Constraint(org.jooq.Constraint) ConstraintEnforcementStep(org.jooq.ConstraintEnforcementStep) CreateDomainConstraintStep(org.jooq.CreateDomainConstraintStep) Named(org.jooq.Named) TableOptions(org.jooq.TableOptions) CreateDomainDefaultStep(org.jooq.CreateDomainDefaultStep) Key(org.jooq.Key) CreateDomainConstraintStep(org.jooq.CreateDomainConstraintStep) CreateDomainDefaultStep(org.jooq.CreateDomainDefaultStep) CreateDomainAsStep(org.jooq.CreateDomainAsStep)

Aggregations

ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 List (java.util.List)1 Check (org.jooq.Check)1 Comment (org.jooq.Comment)1 Constraint (org.jooq.Constraint)1 ConstraintEnforcementStep (org.jooq.ConstraintEnforcementStep)1 CreateDomainAsStep (org.jooq.CreateDomainAsStep)1 CreateDomainConstraintStep (org.jooq.CreateDomainConstraintStep)1 CreateDomainDefaultStep (org.jooq.CreateDomainDefaultStep)1 CreateIndexIncludeStep (org.jooq.CreateIndexIncludeStep)1 CreateSequenceFlagsStep (org.jooq.CreateSequenceFlagsStep)1 CreateTableOnCommitStep (org.jooq.CreateTableOnCommitStep)1 CreateViewAsStep (org.jooq.CreateViewAsStep)1 DDLExportConfiguration (org.jooq.DDLExportConfiguration)1 DDLFlag (org.jooq.DDLFlag)1 CHECK (org.jooq.DDLFlag.CHECK)1 COMMENT (org.jooq.DDLFlag.COMMENT)1