//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//

package table

import (
	"github.com/go-jet/jet/v2/postgres"
)

var FlywaySchemaHistory = newFlywaySchemaHistoryTable("public", "flyway_schema_history", "")

type flywaySchemaHistoryTable struct {
	postgres.Table

	// Columns
	InstalledRank postgres.ColumnInteger
	Version       postgres.ColumnString
	Description   postgres.ColumnString
	Type          postgres.ColumnString
	Script        postgres.ColumnString
	Checksum      postgres.ColumnInteger
	InstalledBy   postgres.ColumnString
	InstalledOn   postgres.ColumnTimestamp
	ExecutionTime postgres.ColumnInteger
	Success       postgres.ColumnBool

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type FlywaySchemaHistoryTable struct {
	flywaySchemaHistoryTable

	EXCLUDED flywaySchemaHistoryTable
}

// AS creates new FlywaySchemaHistoryTable with assigned alias
func (a FlywaySchemaHistoryTable) AS(alias string) *FlywaySchemaHistoryTable {
	return newFlywaySchemaHistoryTable(a.SchemaName(), a.TableName(), alias)
}

// Schema creates new FlywaySchemaHistoryTable with assigned schema name
func (a FlywaySchemaHistoryTable) FromSchema(schemaName string) *FlywaySchemaHistoryTable {
	return newFlywaySchemaHistoryTable(schemaName, a.TableName(), a.Alias())
}

// WithPrefix creates new FlywaySchemaHistoryTable with assigned table prefix
func (a FlywaySchemaHistoryTable) WithPrefix(prefix string) *FlywaySchemaHistoryTable {
	return newFlywaySchemaHistoryTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}

// WithSuffix creates new FlywaySchemaHistoryTable with assigned table suffix
func (a FlywaySchemaHistoryTable) WithSuffix(suffix string) *FlywaySchemaHistoryTable {
	return newFlywaySchemaHistoryTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}

func newFlywaySchemaHistoryTable(schemaName, tableName, alias string) *FlywaySchemaHistoryTable {
	return &FlywaySchemaHistoryTable{
		flywaySchemaHistoryTable: newFlywaySchemaHistoryTableImpl(schemaName, tableName, alias),
		EXCLUDED:                 newFlywaySchemaHistoryTableImpl("", "excluded", ""),
	}
}

func newFlywaySchemaHistoryTableImpl(schemaName, tableName, alias string) flywaySchemaHistoryTable {
	var (
		InstalledRankColumn = postgres.IntegerColumn("installed_rank")
		VersionColumn       = postgres.StringColumn("version")
		DescriptionColumn   = postgres.StringColumn("description")
		TypeColumn          = postgres.StringColumn("type")
		ScriptColumn        = postgres.StringColumn("script")
		ChecksumColumn      = postgres.IntegerColumn("checksum")
		InstalledByColumn   = postgres.StringColumn("installed_by")
		InstalledOnColumn   = postgres.TimestampColumn("installed_on")
		ExecutionTimeColumn = postgres.IntegerColumn("execution_time")
		SuccessColumn       = postgres.BoolColumn("success")
		allColumns          = postgres.ColumnList{InstalledRankColumn, VersionColumn, DescriptionColumn, TypeColumn, ScriptColumn, ChecksumColumn, InstalledByColumn, InstalledOnColumn, ExecutionTimeColumn, SuccessColumn}
		mutableColumns      = postgres.ColumnList{VersionColumn, DescriptionColumn, TypeColumn, ScriptColumn, ChecksumColumn, InstalledByColumn, InstalledOnColumn, ExecutionTimeColumn, SuccessColumn}
	)

	return flywaySchemaHistoryTable{
		Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),

		//Columns
		InstalledRank: InstalledRankColumn,
		Version:       VersionColumn,
		Description:   DescriptionColumn,
		Type:          TypeColumn,
		Script:        ScriptColumn,
		Checksum:      ChecksumColumn,
		InstalledBy:   InstalledByColumn,
		InstalledOn:   InstalledOnColumn,
		ExecutionTime: ExecutionTimeColumn,
		Success:       SuccessColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
