### Exposed 0.56.0 Help

# Working with Schema

A database schema defines how data is organized in a relational database. With Exposed, you can create and drop a new or an existing schema.

## Define a schema

To define a schema in Exposed, use the `Schema` class:

val schema = Schema("my_schema") // my_schema is the schema name.

Additionally, you can specify the schema owner by passing an `authorization` argument (some databases require the explicit owner) :

val schema = Schema("my_schema", authorization = "owner")

## Create a new schema

To create a new schema, use the `createSchema()` method provided by `SchemaUtils`:

SchemaUtils.createSchema(schema)

## Set a default schema

If you have many schemas, and you want to set a default one, you can use the `setSchema()` method from `SchemaUtils`:

SchemaUtils.setSchema(schema)

## Drop a schema

To drop a schema, use the `dropSchema()` method provided by `SchemaUtils`:

SchemaUtils.dropSchema(schema)
Last modified: 30 October 2024