Skip to content

Commit

Permalink
Revert "Refactor"
Browse files Browse the repository at this point in the history
This reverts commit 7d34cbb.
  • Loading branch information
mostlyobvious committed Mar 29, 2024
1 parent 7d34cbb commit 9ca07fb
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions ruby_event_store-active_record/spec/migration_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,15 @@ module ActiveRecord
skip unless ENV["DATABASE_URL"].include?("sqlite")

expect(
sqlite_schema("event_store_events"),
sqlite_schema("event_store_events_in_streams")
::ActiveRecord::Base
.connection
.execute(<<~SQL)
SELECT sql
FROM sqlite_schema
WHERE NAME LIKE '%event_store_events%'
SQL
.map { |x| x["sql"] }
.join("\n")
).to eq <<~SCHEMA.strip
CREATE TABLE "event_store_events" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "event_id" varchar(36) NOT NULL, "event_type" varchar NOT NULL, "metadata" blob, "data" blob NOT NULL, "created_at" datetime(6) NOT NULL, "valid_at" datetime(6))
CREATE UNIQUE INDEX "index_event_store_events_on_event_id" ON "event_store_events" ("event_id")
Expand Down Expand Up @@ -150,18 +157,6 @@ def data_type_to_mysql_type(data_type)
{ "binary" => "blob", "json" => "json" }.fetch(data_type)
end

def sqlite_schema(name)
::ActiveRecord::Base
.connection
.execute(<<~SQL)
SELECT sql
FROM sqlite_schema
WHERE NAME = '#{name}'
SQL
.map { |x| x["sql"] }
.join("\n")
end

def pg_schema(table_name)
IO
.popen(
Expand Down

0 comments on commit 9ca07fb

Please sign in to comment.