Skip to content

Option to auto create index on ColumnOptions.AdditionalDataColumns #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BrandonClapp opened this issue Apr 19, 2017 · 0 comments · Fixed by #166
Closed

Option to auto create index on ColumnOptions.AdditionalDataColumns #81

BrandonClapp opened this issue Apr 19, 2017 · 0 comments · Fixed by #166
Assignees

Comments

@BrandonClapp
Copy link

Is there a way to automatically create index's for specific additional columns when using the autoCreateSqlTable option?

For example:

var columnOptions = new ColumnOptions
{
	AdditionalDataColumns = new Collection<DataColumn>
	{
		new DataColumn("EventType", typeof(long)) // Is there a way to auto index this column?
	}
};

Log.Logger = new LoggerConfiguration()
	.WriteTo.MSSqlServer(
		connectionString: "MyConnectionString",
		tableName: "MyApplicationLogs",
		autoCreateSqlTable: true,
		restrictedToMinimumLevel: LogEventLevel.Information,
		columnOptions: columnOptions)
	.Enrich.FromLogContext()
	.Enrich.With<EventTypeEnricher>() // custom enricher to add additional property (see above additional column)
	.CreateLogger();

If not, this may be a good feature to add. We will likely auto-create the table once in development, add the indexes manually, and then script the table schema's for a production deploy.

@BrandonClapp BrandonClapp changed the title Ability to create index from ColumnOptions.DataColumn Option to auto create index on ColumnOptions.AdditionalDataColumns Apr 19, 2017
@nblumhardt nblumhardt added enhancement up-for-grabs This issue waits for a contributor to fix it. labels Jan 3, 2018
@MV10 MV10 self-assigned this Oct 7, 2018
@MV10 MV10 removed the up-for-grabs This issue waits for a contributor to fix it. label Oct 7, 2018
@MV10 MV10 closed this as completed in #166 Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants