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

Support INDEX creation in import_from_json #191

Open
majdisorder opened this issue Oct 20, 2024 · 2 comments
Open

Support INDEX creation in import_from_json #191

majdisorder opened this issue Oct 20, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@majdisorder
Copy link

Is your feature request related to a problem? Please describe.

It would be a nice addition if import_from_json had INDEX support. This will further the capabilities for users who wish to use import_from_json as a way to create a (empty) database instance.

Describe the solution you'd like

Add support for a new object with "type": "index" to import_from_json.
I guess it would also make sense to include indexes in export_to_json.

As an alternative, an "indexes": [] property could be introduced to the "type": "table" object.

Describe alternatives you've considered

It's now possible to tack on a CREATE INDEX at the end of your table's "sql" property. This is okay for single indexes but quickly becomes unreadable and unwieldy for multiple indexes or tables with many columns.

[{
	"name": "my_table",	
	"sql": "CREATE TABLE my_table (..., col_name TEXT); CREATE UNIQUE INDEX my_table_col_ix ON my_table(col_name);",
	"type": "table",
	"row_array":[]
}]
@majdisorder majdisorder added the enhancement New feature or request label Oct 20, 2024
@2shady4u 2shady4u self-assigned this Dec 14, 2024
@2shady4u 2shady4u added this to the v4.5 milestone Dec 14, 2024
@2shady4u
Copy link
Owner

@majdisorder I will implement this!

@2shady4u
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants