Skip to content

Commit

Permalink
Refactor foreign keys and clean up test setup
Browse files Browse the repository at this point in the history
Updated foreign key references in PostgreSQL schema tests to match
actual column names, improving alignment with the database schema.
Removed unnecessary delay in SQLite schema tests to speed up
test execution. Corrected file deletion in migration tests to target
the correct test database file.
  • Loading branch information
eliasjpr committed Aug 13, 2024
1 parent 3f2d725 commit b2b427e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions spec/adapters/postgres_schema_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ describe Cql::Schema do
primary :customer_id, Int64, auto_increment: true
column :customer_name, String, as: "cust_name"
column :city, String
column :country, Int64
column :country_id, Int64
end

Example.customers.create!

Example.alter :customers do
foreign_key :fk_country, [:country], :countries, [:country_id]
foreign_key :fk_country, [:country_id], :countries, [:id]
end
end

Expand All @@ -158,7 +158,7 @@ describe Cql::Schema do
Example.customers.create!

Example.alter :customers do
foreign_key :fk_country, [:country_id], :countries, [:country_id]
foreign_key :fk_country, [:country_id], :countries, [:id]
end

Example.alter :customers do
Expand Down
4 changes: 0 additions & 4 deletions spec/adapters/sqlite_schema_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ describe Cql::Schema do
end
end

before_each do
sleep 1.seconds
end

it "creates a table" do
Data.customers.drop!
Data.customers.create!
Expand Down
2 changes: 1 addition & 1 deletion spec/migration_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe Cql::Migration do
migrator = Northwind.migrator

after_all do
File.delete("spec/db/data.db")
File.delete("spec/db/northwind.db")
end

it "has a migration" do
Expand Down

0 comments on commit b2b427e

Please sign in to comment.