You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
options="MergeTree PARTITION BY toYYYYMM(timestamp) ORDER BY timestamp"create_table:events,id: false,force: :cascade,options: do |t|
t.datetime:timestamp,null: falseend
The generated schema.rb file looks like:
create_table"events",primary_key: "timestamp",id: :datetime,precision: nil,options: "MergeTree PARTITION BY toYYYYMM(timestamp) ORDER BY timestamp SETTINGS index_granularity = 8192",force: :cascadedo |t|
end
When attempting to load this schema it fails with:
@PNixx thanks for looking into this, but unfortunately the new version did not fix this issue for me.
I'm no longer getting any primary_key: in the dump but I'm still not getting the timestamp columns added inside the create_table statements. Here's the diff I'm getting with the new version:
Both the email_sg_events and web_clickstream_events tables are missing timestamp in the dump.
I tried both just running db:schema:dump on my existing database and dropping and re-migrating the database from scratch, both result in the same diff.
In the # SQL: CREATE TABLE ... comment the column does exist as expected, but not in the DSL output. Full email_sg_events section:
# TABLE: email_sg_events# SQL: CREATE TABLE email_sg_events ( `uuid` Nullable(String), `email` Nullable(String), `event` Nullable(String), `sg_message_id` Nullable(String), `url` Nullable(String), `url_offset` Nullable(String), `ip` Nullable(String), `useragent` Nullable(String), `timestamp` DateTime, `reason` Nullable(String) ) ENGINE = MergeTree PARTITION BY toYYYYMM(timestamp) ORDER BY timestamp SETTINGS index_granularity = 8192create_table"email_sg_events",id: false,options: "MergeTree PARTITION BY toYYYYMM(timestamp) ORDER BY timestamp SETTINGS index_granularity = 8192",force: :cascadedo |t|
t.string"uuid"t.string"email"t.string"event"t.string"sg_message_id"t.string"url"t.string"url_offset"t.string"ip"t.string"useragent"t.string"reason"end
Given the following migration:
The generated schema.rb file looks like:
When attempting to load this schema it fails with:
It appears that the timestamp column needs to be explicitly defined inside of the block. It's not enough that it's declared as
primary_key: "..."
.The issue doesn't occur when ordering by multiple columns (ie. composite primary keys).
Also the issue doesn't occur when using
schema_format = :sql
.The text was updated successfully, but these errors were encountered: