Trait rustorm::database::DatabaseDDL [] [src]

pub trait DatabaseDDL {
    fn create_schema(&self, schema: &str);
    fn drop_schema(&self, schema: &str);
    fn create_table(&self, model: &Table);
    fn build_create_table(&self, table: &Table) -> SqlFrag;
    fn rename_table(&self, table: &Table, new_tablename: String);
    fn drop_table(&self, table: &Table);
    fn set_foreign_constraint(&self, model: &Table);
    fn set_primary_constraint(&self, model: &Table);
}

Deployment Database should implement this trait, to enable automated installation of the app, regardless what database platform the app is developed from.

Required Methods

fn create_schema(&self, schema: &str)

The following methods involves DDL(Data definition language) operation create a database schema

fn drop_schema(&self, schema: &str)

drop the database schema

fn create_table(&self, model: &Table)

create a database table based on the Model Definition

fn build_create_table(&self, table: &Table) -> SqlFrag

build sql for create table

fn rename_table(&self, table: &Table, new_tablename: String)

rename table, in the same schema

fn drop_table(&self, table: &Table)

drop table

fn set_foreign_constraint(&self, model: &Table)

set the foreign key constraint of a table

fn set_primary_constraint(&self, model: &Table)

set the primary key constraint of a table

Implementors