clickhouse-activerecord
clickhouse-activerecord copied to clipboard
Missing `schema_migrations` table in schema dump
Version: clickhouse-activerecord (1.0.9) Rails: 7.1
I have a rails app with config.active_record.schema_format = :sql
. When I run the db:schema:dump
command the schema_migrations table is being ignored and does not end up in the db/clickhouse_structure.sql
file.
The migrations versions are considered part of the schema dump. And I do end up with statements appended to the end of the file that look like:
-- create some tables etc
-- at the end of the db/clickhouse_structure.sql file, are the AR schema migration inserts:
INSERT INTO schema_migrations (version) VALUES
('20240603201007');
However, because the schema_migrations
table is not preset in the structure file, when I do something like RAILS_ENV=test ./bin/rails db:create db:prepare
these insert statements produce an error, because the schema_migrations table is not present.
Compared to the PostgreSQL adapter (for example), there is a schema_migrations table in the structure dump that looks like:
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.schema_migrations (
version character varying NOT NULL
);