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

Add support for composite keys #82

Open
qadirpervez opened this issue Nov 17, 2023 · 0 comments
Open

Add support for composite keys #82

qadirpervez opened this issue Nov 17, 2023 · 0 comments
Labels
breaking Requires a major version bump enhancement New feature or request

Comments

@qadirpervez
Copy link

The schema:build command generates a JSON file containing schema information. However, when a table has multiple columns combined as a primary key, the generated JSON only includes the first column as the primary key. This behavior is inconsistent with expectations, as it should provide information for all columns in the composite primary key.

Current Behavior

CREATE TABLE example_table (
    column1 INT,
    column2 INT,
    PRIMARY KEY (column1, column2)
);

schema:build generates:

"example_table ": {
	"name": "example_table",
	"type": "table",
	"columns": {
		"column1": {
			"name": "column1",
			"type": "INT",
			"primaryKey": true
		},
		"column2": {
			"name": "column2",
			"type": "INT",
			"primaryKey": false
		}
	},
	"primaryKey": "column1"
},

Expected Behavior

CREATE TABLE example_table (
    column1 INT,
    column2 INT,
    PRIMARY KEY (column1, column2)
);

schema:build to generate:

"example_table ": {
	"name": "example_table",
	"type": "table",
	"columns": {
		"column1": {
			"name": "column1",
			"type": "INT",
			"primaryKey": true
		},
		"column2": {
			"name": "column2",
			"type": "INT",
			"primaryKey": true
		}
	},
	"primaryKey": ["column1", "column2"]
},
@DrewImm DrewImm added breaking Requires a major version bump and removed breaking Requires a major version bump labels Jan 13, 2024
@DrewImm DrewImm changed the title Inaccurate Handling of Composite Primary Keys in schema:build Command Add support for composite keys Feb 9, 2024
@DrewImm DrewImm added the enhancement New feature or request label Feb 9, 2024
@DrewImm DrewImm added the breaking Requires a major version bump label Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Requires a major version bump enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants