Skip to content
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

tables: Match column attributes to usage #6122

Merged
merged 3 commits into from
Dec 15, 2019

Conversation

theopolis
Copy link
Member

I did another audit of table implementations and how they use column constraints. These changes seem to match how I saw the constraints used and what makes sense from a primary-key == index perspective.

Copy link
Member

@directionless directionless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading through these, I see another one -- The rpm_packages.table should probably set additional on version. release, epoch.

specs/darwin/browser_plugins.table Show resolved Hide resolved
@@ -4,7 +4,7 @@ schema([
Column("type", TEXT, "Type of crash log"),
Column("pid", BIGINT, "Process (or thread) ID of the crashed process"),
Column("path", TEXT, "Path to the crashed process"),
Column("crash_path", TEXT, "Location of log file"),
Column("crash_path", TEXT, "Location of log file", index=True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this in the c++ implementation, and looking at my machine, I think it's incorrect from a primary key perspective.

crash_path could, maybe, be a primary key.

specs/darwin/keychain_items.table Show resolved Hide resolved
specs/posix/docker_container_labels.table Show resolved Hide resolved
@@ -2,8 +2,8 @@ table_name("docker_container_processes")
description("Docker container processes.")
schema([
Column("id", TEXT, "Container ID", index=True, required=True),
Column("pid", BIGINT, "Process ID"),
Column("name", TEXT, "The process path or shorthand argv[0]", index=True),
Column("pid", BIGINT, "Process ID", index=True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this used as an index. Maybe additional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The combination of id and pid are the PRIMARY KEY for this table.

specs/posix/docker_volume_labels.table Show resolved Hide resolved
@theopolis
Copy link
Member Author

Thanks for the review, I will make some follow up changes. Like you pointed out, I intentionally added several indexs where the table should have a primary key.

Copy link
Contributor

@muffins muffins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants