import * as Sequelize from 'sequelize';
import { DataTypes, Model, Optional } from 'sequelize';
export interface SchemaMigrationAttributes {
	id: number;
	migration_name: string;
	applied_at?: Date | null;
}
export type SchemaMigrationPk = 'id';
export type SchemaMigrationId = SchemaMigration[SchemaMigrationPk];
export type SchemaMigrationOptionalAttributes = 'id' | 'applied_at';
export type SchemaMigrationCreationAttributes = Optional<SchemaMigrationAttributes, SchemaMigrationOptionalAttributes>;
export class SchemaMigration extends Model<SchemaMigrationAttributes> implements SchemaMigrationAttributes {
	declare id: number;
	declare migration_name: string;
	declare applied_at?: Date | null;
	static initModel(sequelize: Sequelize.Sequelize): typeof SchemaMigration {
		return SchemaMigration.init(
			{
				id: {
					autoIncrement: true,
					type: DataTypes.INTEGER,
					allowNull: false,
					primaryKey: true,
				},
				migration_name: {
					type: DataTypes.STRING(255),
					allowNull: false,
					unique: 'schema_migrations_migration_name_key',
				},
				applied_at: {
					type: DataTypes.DATE,
					allowNull: true,
					defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
				},
			},
			{
				sequelize,
				tableName: 'schema_migrations',
				schema: 'public',
				timestamps: false,
				indexes: [
					{
						name: 'schema_migrations_migration_name_key',
						unique: true,
						fields: [{ name: 'migration_name' }],
					},
					{
						name: 'schema_migrations_pkey',
						unique: true,
						fields: [{ name: 'id' }],
					},
				],
			},
		);
	}
}
