{"size": 1202, "ext": "js", "max_stars_repo_path": "server/api/mysql/SimilarTaxa/SimilarTaxa.model.js", "max_stars_repo_name": "NHMD/svampeatlas", "max_stars_repo_stars_event_min_datetime": "2017-12-15T10:26:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T09:18:54.000Z", "max_issues_repo_path": "server/api/mysql/SimilarTaxa/SimilarTaxa.model.js", "max_issues_repo_name": "NHMD/svampeatlas", "max_issues_repo_issues_event_min_datetime": "2017-11-06T10:30:39.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-20T15:33:03.000Z", "max_forks_repo_path": "server/api/mysql/SimilarTaxa/SimilarTaxa.model.js", "max_forks_repo_name": "NHMD/svampeatlas", "max_forks_repo_forks_event_min_datetime": "2019-08-19T12:28:09.000Z", "max_forks_repo_forks_event_max_datetime": "2019-08-19T12:28:09.000Z"}
{"max_stars_count": 3, "max_issues_count": 82, "max_forks_count": 1, "avg_line_length": 17.9402985075, "max_line_length": 52, "alphanum_fraction": 0.5998336106}
'use strict';

module.exports = function(sequelize, DataTypes) {
	var SimilarTaxa = sequelize.define('SimilarTaxa', {
		_id: {
			type: DataTypes.INTEGER,
			allowNull: false,
			primaryKey: true,
			autoIncrement: true
		},
		
		createdAt: {
			type: DataTypes.DATE,
			allowNull: false,
			defaultValue: DataTypes.NOW
		},
		updatedAt: {
			type: DataTypes.DATE,
			allowNull: true,
			defaultValue: DataTypes.NOW
		},
		createdbyuser_id: {
			type: DataTypes.INTEGER,
			allowNull: false
		},
		taxon1_id: {
			type: DataTypes.INTEGER,
			allowNull: false
		},
		taxon2_id: {
			type: DataTypes.INTEGER,
			allowNull: false
		}
	}, {
		tableName: 'SimilarTaxa',
		//	timestamps: false,
		freezeTableName: true,
    	classMethods: {

    		associate: function(models) {
		
    			models.SimilarTaxa
    				.belongsTo(models.Taxon, {
    					foreignKey: "taxon1_id",
    					as: "Taxon1"
    				});
					
    			models.SimilarTaxa
    				.belongsTo(models.Taxon, {
    					foreignKey: "taxon2_id",
    					as: "Taxon2"
    				});
				
			models.SimilarTaxa
				.belongsTo(models.User, {
					foreignKey: "createdbyuser_id",
					as: "User"
				});
			}
			
			}

	});

	return SimilarTaxa;
};
