Skip to content

Add database field support to migrations#48

Open
nlenepveu wants to merge 1 commit into
juneHQ:masterfrom
nlenepveu:feature/add-database-field-to-migrations
Open

Add database field support to migrations#48
nlenepveu wants to merge 1 commit into
juneHQ:masterfrom
nlenepveu:feature/add-database-field-to-migrations

Conversation

@nlenepveu

Copy link
Copy Markdown

Allow migrations to specify which database tables should be created in by adding an optional database field to migration YAML files.

Changes:

  • Extract database field from migration files in migrate_up() and migrate_down()
  • Add database to format_args for SQL template substitution
  • Update database query methods to accept optional database parameter
  • Modify update_schema() to query correct databases and use qualified table names
  • Include database field in generated migration template (commented out)

The database field is optional and defaults to the current database connection (CLICKHOUSE_DB) when not specified, maintaining backward compatibility.

This enables creating tables in different databases within the same ClickHouse instance, addressing the limitation where all tables were created in the default database.

Allow migrations to specify which database tables should be created in
by adding an optional `database` field to migration YAML files.

Changes:
- Extract `database` field from migration files in migrate_up() and migrate_down()
- Add `database` to format_args for SQL template substitution
- Update database query methods to accept optional database parameter
- Modify update_schema() to query correct databases and use qualified table names
- Include database field in generated migration template (commented out)

The database field is optional and defaults to the current database connection
(CLICKHOUSE_DB) when not specified, maintaining backward compatibility.

This enables creating tables in different databases within the same ClickHouse
instance, addressing the limitation where all tables were created in the
default database.
@nlenepveu

Copy link
Copy Markdown
Author

Hi @vinayak-mehta, could you please take a look when you get a chance?
Let me know if you’d like any changes and I’ll update right away!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant