sql-ddl-to-json-schema
Version:
Parse and convert SQL DDL statements to a JSON Schema.
57 lines (56 loc) • 2.11 kB
TypeScript
import { O_CREATE_TABLE_CREATE_DEFINITION, P_CREATE_INDEX, O_CREATE_TABLE_CREATE_DEFINITION_FULLTEXT_INDEX, O_ALTER_TABLE_SPEC_ADD_FULLTEXT_INDEX, FulltextIndexInterface } from '../../../../typings';
import { FulltextIndexModelInterface, IndexColumnModelInterface, IndexOptionsModelInterface, ColumnModelInterface, TableModelInterface } from './typings';
/**
* Fulltext index of a table.
*/
export declare class FulltextIndex implements FulltextIndexModelInterface {
name?: string;
columns: IndexColumnModelInterface[];
options?: IndexOptionsModelInterface;
/**
* Creates a fulltext index from a JSON def.
*
* @param json JSON format parsed from SQL.
*/
static fromDef(json: O_CREATE_TABLE_CREATE_DEFINITION | P_CREATE_INDEX): FulltextIndex;
/**
* Creates a fulltext index from an object containing needed properties.
*
* @param json Object containing properties.
*/
static fromObject(json: O_CREATE_TABLE_CREATE_DEFINITION_FULLTEXT_INDEX | P_CREATE_INDEX['def'] | O_ALTER_TABLE_SPEC_ADD_FULLTEXT_INDEX): FulltextIndex;
/**
* JSON casting of this object calls this method.
*/
toJSON(): FulltextIndexInterface;
/**
* Create a deep clone of this model.
*/
clone(): FulltextIndex;
/**
* Drops a column from index, returning whether column was removed.
*
* @param name Column name to be dropped.
*/
dropColumn(name: string): boolean;
/**
* Get the columns in given table which this
* fulltext index's index columns refer to.
*
* @param table Table in question.
*/
getColumnsFromTable(table: TableModelInterface): ColumnModelInterface[];
/**
* Get whether the given table has all of this fultext index's columns.
*
* @param table Table in question.
*/
hasAllColumnsFromTable(table: TableModelInterface): boolean;
/**
* Rename index column name.
*
* @param column Column being renamed.
* @param newName New column name.
*/
renameColumn(column: ColumnModelInterface, newName: string): void;
}