Skip to content

Commit

Permalink
Reverting all of the changed files.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoertink committed Nov 10, 2024
1 parent bac8beb commit 40c9e12
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- 14
- 16
crystal_version:
- 1.11.0
- 1.10.0
- latest
experimental:
- false
Expand Down
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: avram
version: 1.3.0

crystal: ">= 1.11.0"
crystal: ">= 1.10.0"

license: MIT

Expand Down
10 changes: 5 additions & 5 deletions spec/avram/migrator/alter_table_statement_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe Avram::Migrator::AlterTableStatement do
end

built.statements.size.should eq 3
built.statements[0].should eq %(ALTER TABLE users#{EOL} ADD "confirmed_at" timestamptz;)
built.statements[0].should eq %(ALTER TABLE users\n ADD "confirmed_at" timestamptz;)
built.statements[1].should eq "UPDATE users SET confirmed_at = NOW();"
built.statements[2].should eq "ALTER TABLE users ALTER COLUMN confirmed_at SET NOT NULL;"
end
Expand All @@ -117,7 +117,7 @@ describe Avram::Migrator::AlterTableStatement do
end

built.statements.size.should eq 2
built.statements[0].should eq %(ALTER TABLE users#{EOL} ADD "confirmed_at" timestamptz;)
built.statements[0].should eq %(ALTER TABLE users\n ADD "confirmed_at" timestamptz;)
built.statements[1].should eq "UPDATE users SET confirmed_at = NOW();"
end

Expand All @@ -127,7 +127,7 @@ describe Avram::Migrator::AlterTableStatement do
end

built.statements.size.should eq 3
built.statements[0].should eq %(ALTER TABLE users#{EOL} ADD "admin" boolean;)
built.statements[0].should eq %(ALTER TABLE users\n ADD "admin" boolean;)
built.statements[1].should eq "UPDATE users SET admin = 'false';"
built.statements[2].should eq "ALTER TABLE users ALTER COLUMN admin SET NOT NULL;"
end
Expand Down Expand Up @@ -178,7 +178,7 @@ describe Avram::Migrator::AlterTableStatement do
end

built.statements.size.should eq 4
built.statements[0].should eq %(ALTER TABLE comments#{EOL} ADD "line_item_id" uuid NOT NULL REFERENCES line_items ON DELETE CASCADE;)
built.statements[0].should eq %(ALTER TABLE comments\n ADD "line_item_id" uuid NOT NULL REFERENCES line_items ON DELETE CASCADE;)
built.statements[1].should eq %(CREATE INDEX comments_line_item_id_index ON comments USING btree ("line_item_id");)
built.statements[2].should eq "UPDATE comments SET line_item_id = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11';"
built.statements[3].should eq "ALTER TABLE comments ALTER COLUMN line_item_id SET NOT NULL;"
Expand All @@ -190,7 +190,7 @@ describe Avram::Migrator::AlterTableStatement do
end

built.statements.size.should eq 3
built.statements[0].should eq %(ALTER TABLE comments#{EOL} ADD "line_item_id" uuid REFERENCES line_items ON DELETE CASCADE;)
built.statements[0].should eq %(ALTER TABLE comments\n ADD "line_item_id" uuid REFERENCES line_items ON DELETE CASCADE;)
built.statements[1].should eq %(CREATE INDEX comments_line_item_id_index ON comments USING btree ("line_item_id");)
built.statements[2].should eq "UPDATE comments SET line_item_id = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11';"
end
Expand Down
4 changes: 2 additions & 2 deletions spec/avram/migrator/create_table_statement_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe Avram::Migrator::CreateTableStatement do

built.statements.size.should eq 1
built.statements.first.should eq <<-SQL
CREATE TABLE users (#{EOL});
CREATE TABLE users (\n);
SQL
end

Expand Down Expand Up @@ -254,7 +254,7 @@ describe Avram::Migrator::CreateTableStatement do

built.statements.size.should eq 1
built.statements.first.should eq <<-SQL
CREATE TABLE IF NOT EXISTS users (#{EOL});
CREATE TABLE IF NOT EXISTS users (\n);
SQL
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/avram/migrator/alter_table_statement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ class Avram::Migrator::AlterTableStatement
unless (rows + dropped_rows).empty?
alterations << String.build do |statement|
statement << "ALTER TABLE #{if_exists_statement}#{@table_name}"
statement << EOL
statement << (rows + dropped_rows).join(",#{EOL}")
statement << "\n"
statement << (rows + dropped_rows).join(",\n")
statement << ';'
end
end
Expand Down
8 changes: 4 additions & 4 deletions src/avram/migrator/create_table_statement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class Avram::Migrator::CreateTableStatement
private def table_statement
String.build do |statement|
initial_table_statement(statement)
statement << rows.join(",#{EOL}")
statement << ",#{EOL}" if !constraints.empty?
statement << constraints.join(", #{EOL}")
statement << rows.join(",\n")
statement << ",\n" if !constraints.empty?
statement << constraints.join(", \n")
statement << ");"
end
end
Expand All @@ -67,7 +67,7 @@ class Avram::Migrator::CreateTableStatement
io << "CREATE TABLE "
io << "IF NOT EXISTS " if if_not_exists?
io << @table_name
io << " (#{EOL}"
io << " (\n"
end

macro primary_key(type_declaration)
Expand Down
4 changes: 2 additions & 2 deletions src/avram/tasks/gen/migration_generator.cr
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ class Avram::Migrator::MigrationGenerator

private def pad_contents(contents : String) : String
String.build do |string|
contents.split(EOL).each_with_index do |line, index|
contents.split("\n").each_with_index do |line, index|
if index.zero?
string << line
else
string << " "
string << line
end
string << EOL
string << "\n"
end
end.chomp
end
Expand Down

0 comments on commit 40c9e12

Please sign in to comment.