<commit_before>﻿using System;
using System.Collections.Generic;

namespace model {
	public class Column {
		public string Name;
		public int Position;
		public Default Default;
		public bool IsNullable;
		public string Type;
		public int Length;
		public byte Precision;
		public int Scale;
		public Identity Identity;

		private string IsNullableText {
			get {
				if (IsNullable) return "NULL";
				return "NOT NULL";
			}
		}

		public string DefaultText {
			get {
				if (this.Default == null) return "";
				return "\r\n      " + this.Default.Script();
			}
		}

		public string IdentityText {
			get {
				if (this.Identity == null) return "";
				return "\r\n      " + this.Identity.Script();
			}
		}

		public Column() {

		}

		public Column(string name, string type, bool @null, Default @default) {
			this.Name = name;
			this.Type = type;
			this.Default = @default;
		}

		public Column(string name, string type, int length, bool @null, Default @default)
			: this(name, type, @null, @default) {
			this.Length = length;
		}

		public Column(string name, string type, byte precision, int scale, bool @null, Default @default)
			: this(name, type, @null, @default) {
			this.Precision = precision;
			this.Scale = scale;
		}

		public ColumnDiff Compare(Column c) {
			return new ColumnDiff(this, c);
		}

		public string Script() {
			switch (Type) {
				case "bigint":
				case "bit":
				case "datetime":
				case "float":
				case "image":
				case "int":
				case "money":
				case "ntext":
				case "real":
				case "smalldatetime":
				case "smallint":
				case "smallmoney":
				case "sql_variant":
				case "text":
				case "timestamp":
				case "tinyint":
				case "uniqueidentifier":
				case "xml":

					return string.Format("[{0}] [{1}] {2} {3} {4}", Name, Type, IsNullableText, DefaultText, IdentityText);
				case "binary":
				case "char":
				case "nchar":
				case "nvarchar":
				case "varbinary":
				case "varchar":
					string lengthString = Length.ToString();
					if (lengthString == "-1") lengthString = "max";

					return string.Format("[{0}] [{1}]({2}) {3} {4}", Name, Type, lengthString, IsNullableText, DefaultText);
				case "decimal":
				case "numeric":<commit_msg>closes #2 - added support for date type<commit_after>﻿using System;
using System.Collections.Generic;

namespace model {
	public class Column {
		public string Name;
		public int Position;
		public Default Default;
		public bool IsNullable;
		public string Type;
		public int Length;
		public byte Precision;
		public int Scale;
		public Identity Identity;

		private string IsNullableText {
			get {
				if (IsNullable) return "NULL";
				return "NOT NULL";
			}
		}

		public string DefaultText {
			get {
				if (this.Default == null) return "";
				return "\r\n      " + this.Default.Script();
			}
		}

		public string IdentityText {
			get {
				if (this.Identity == null) return "";
				return "\r\n      " + this.Identity.Script();
			}
		}

		public Column() {

		}

		public Column(string name, string type, bool @null, Default @default) {
			this.Name = name;
			this.Type = type;
			this.Default = @default;
		}

		public Column(string name, string type, int length, bool @null, Default @default)
			: this(name, type, @null, @default) {
			this.Length = length;
		}

		public Column(string name, string type, byte precision, int scale, bool @null, Default @default)
			: this(name, type, @null, @default) {
			this.Precision = precision;
			this.Scale = scale;
		}

		public ColumnDiff Compare(Column c) {
			return new ColumnDiff(this, c);
		}

		public string Script() {
			switch (Type) {
				case "bigint":
				case "bit":
				case "date":
				case "datetime":
				case "float":
				case "image":
				case "int":
				case "money":
				case "ntext":
				case "real":
				case "smalldatetime":
				case "smallint":
				case "smallmoney":
				case "sql_variant":
				case "text":
				case "timestamp":
				case "tinyint":
				case "uniqueidentifier":
				case "xml":

					return string.Format("[{0}] [{1}] {2} {3} {4}", Name, Type, IsNullableText, DefaultText, IdentityText);
				case "binary":
				case "char":
				case "nchar":
				case "nvarchar":
				case "varbinary":
				case "varchar":
					string lengthString = Length.ToString();
					if (lengthString == "-1") lengthString = "max";

					return string.Format("[{0}] [{1}]({2}) {3} {4}", Name, Type, lengthString, IsNullableText, DefaultText);
				case "decimal":
				case "numeric":
{'fraction_non_alphanumeric': 0.1371057928874972, 'fraction_numerical': 0.005144263028405279, 'mean_word_length': 2.9680567879325643, 'pattern_counts': {'":': 53, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3986858', 'n_tokens_mistral': 1775, 'n_tokens_neox': 1401, 'n_words': 443}