Class Schema

    • Constructor Detail

      • Schema

        public Schema​(DatabaseObjectWriter writer,
                      String name)
        Create a new database schema.
        Parameters:
        writer - database object writer
        name - name of the database schema
    • Method Detail

      • getType

        public String getType()
        Description copied from interface: DatabaseObject
        Get the type of the database object.
        Returns:
        type of the database object
      • hasParent

        public boolean hasParent()
        Description copied from interface: DatabaseObject
        Check if this object has a parent object that sets the scope within the database
        Returns:
        true if the object has a parent
      • getParent

        public DatabaseObject getParent()
        Description copied from interface: DatabaseObject
        Get the parent object.
        Returns:
        parent object
      • getTables

        public List<Table> getTables()
        Get the tables inside this schema.
        Returns:
        list of tables in this schema
      • createAdapterScript

        public AdapterScript createAdapterScript​(String name,
                                                 AdapterScript.Language language,
                                                 String content)
        Create an adapter script.
        Parameters:
        name - name of the adapter script
        language - language the adapter script is implemented in
        content - implementation of the script
        Returns:
        adapter script
      • createTableBuilder

        public Table.Builder createTableBuilder​(String name)
        Create a builder for a table.

        In cases where you need a more complex table than can be created by the convenience methods createTable, this method provides a builder.

        Parameters:
        name - table name
        Returns:
        builder for the table
      • createTable

        public Table createTable​(String name,
                                 List<String> columnNames,
                                 List<String> columnTypes)
        Create a table with an arbitrary number of columns.
        Parameters:
        name - name of the table
        columnNames - list of column names
        columnTypes - list of column types
        Returns:
        table
      • createTable

        public Table createTable​(String name,
                                 String column1Name,
                                 String column1Type)
        Create a table with one column.
        Parameters:
        name - name of the table
        column1Name - name of the first column
        column1Type - type of the first column
        Returns:
        table
      • createTable

        public Table createTable​(String name,
                                 String column1Name,
                                 String column1Type,
                                 String column2Name,
                                 String column2Type)
        Create a table with two columns.
        Parameters:
        name - name of the table
        column1Name - name of the first column
        column1Type - type of the first column
        column2Name - name of the second column
        column2Type - type of the second column
        Returns:
        table
      • createTable

        public Table createTable​(String name,
                                 String column1Name,
                                 String column1Type,
                                 String column2Name,
                                 String column2Type,
                                 String column3Name,
                                 String column3Type)
        Create a table with three columns.
        Parameters:
        name - name of the table
        column1Name - name of the first column
        column1Type - type of the first column
        column2Name - name of the second column
        column2Type - type of the second column
        column3Name - name of the third column
        column3Type - type of the third column
        Returns:
        table
      • createScript

        public Script createScript​(String name,
                                   String content,
                                   String... parameterNames)
        Create a script that does not return anything.
        Parameters:
        name - name of the script
        content - implementation of the script
        parameterNames - names of the parameters of the script
        Returns:
        script
      • createScript

        public Script createScript​(String name,
                                   Path path,
                                   String... parameterNames)
        Create a script and load its implementation from a file.
        Parameters:
        name - name of the script
        path - path to file containing the script implementation
        parameterNames - names of the parameters of the script
        Returns:
        script
      • createScriptBuilder

        public Script.Builder createScriptBuilder​(String name)
        Create a builder for a database script.
        Parameters:
        name - name of the script
        Returns:
        builder