PNixx / clickhouse-activerecord

A Ruby database ActiveRecord driver for ClickHouse
MIT License
202 stars 100 forks source link

Normalize table name in schema dump #147

Closed danielwestendorf closed 4 months ago

danielwestendorf commented 4 months ago

When running separate databases for different environments (i.e. development, test) on the same machine, you will likely specify a different database name in database.yml. If you then run migrations in a different ENV, you will get schema changes as the database name will be dumped to the schema comments.

This change strips the database name from the schema, leaving only the table name.

Before:

# SQL: CREATE TABLE database_name.table_name
create_table "table_name" ...

Afteer:

# SQL: CREATE TABLE table_name
create_table "table_name" ...
danielwestendorf commented 4 months ago

This change is not correct. I will make another attempt.