sequelize-rails 0.6.0 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4f3572fa044301c579e0760ae4ba8247d043093ab3c8756dfd380829806ac16
4
- data.tar.gz: f523555fe11cb97ff974e6f7f4949208b2071a272d5e28ab9fe70decce299839
3
+ metadata.gz: 70e996b8b359c9a17b548d9739a3c073de2e90925e2d1d03e7df9a9ab97eec20
4
+ data.tar.gz: 9050241fa762162d5f5512e453a9dbddf6225df1f2573fd99e6ef6617d1e7cc9
5
5
  SHA512:
6
- metadata.gz: 06bbac5d130b2fb85940230f313a8fe8907efc08084a851986f89868f7ee9e2a395c20d7ed52014d92b904fb5a6e79e068b3cdf47562d8f91890dd294f788a39
7
- data.tar.gz: 7cbfc94ec5c533cf05f3a4c81e625cec6dd3c7cab7aba972a62d7e68175749cb4abcf7a7e37b225dc99ea556d6319a912e39986e2b15f031a5b82089d19731f5
6
+ metadata.gz: 98376659022b9357a37c8ad474f4f258aa77dd4357c3fef63e33b3e231e63d255aaefc28e98817daf207626a5126f38a847e0f8d725bd27ec7b81511622a3fdd
7
+ data.tar.gz: fb462d27082f7f01c90d6c13ac83fbc62fe707a616c717e9f25c36f810b7954932d3ece4756ac70dfd07b2662e47a90621dc04445192b1d49c4e7d4d216e881b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.1] - 2023-09-04
4
+
5
+ - Migrations now generate SQL files by default
6
+
3
7
  ## [0.6.0] - 2023-09-04
4
8
 
5
9
  - Adds migration generator
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sequelize-rails (0.6.0)
4
+ sequelize-rails (0.6.1)
5
5
  activerecord (>= 6.0.0)
6
6
  rails (>= 6.0.0)
7
7
  sequel (>= 5.0.0)
@@ -15,6 +15,8 @@ module Sequel
15
15
 
16
16
  def create_migration_file
17
17
  migration_template "migration.rb.erb", "db/migrate/#{file_name}.rb"
18
+ migration_template "up.sql.erb", "db/migrate/#{file_name}_up.sql"
19
+ migration_template "down.sql.erb", "db/migrate/#{file_name}_down.sql"
18
20
  end
19
21
  end
20
22
  end
@@ -0,0 +1 @@
1
+ -- Write rollback migration here
@@ -1,9 +1,10 @@
1
1
  Sequel.migration do
2
+ transaction
2
3
  up do
3
- # Add forward migration code here
4
+ run File.read(File.join(File.dirname(__FILE__), "#{File.basename(__FILE__, ".rb")}_up.sql"))
4
5
  end
5
6
 
6
7
  down do
7
- # Add rollback migration code here
8
+ run File.read(File.join(File.dirname(__FILE__), "#{File.basename(__FILE__, ".rb")}_down.sql"))
8
9
  end
9
10
  end
@@ -0,0 +1 @@
1
+ -- Write forwards migration here
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sequel
4
4
  module Rails
5
- VERSION = "0.6.0"
5
+ VERSION = "0.6.2"
6
6
  end
7
7
  end
@@ -141,7 +141,17 @@ db_namespace = namespace ns do
141
141
  end
142
142
 
143
143
  desc "Rolls back the last migration and re-runs it"
144
- task redo: [:down, :up]
144
+ task redo: [:connection] do
145
+ # down
146
+ target = (migrator.applied_migrations[-2] || "0_").split("_", 2).first.to_i
147
+ migrator(target: target).run
148
+ # up
149
+ pending = migrator.migration_tuples.first
150
+ if pending
151
+ target = pending[1].split("_", 2).first.to_i
152
+ migrator(target: target).run
153
+ end
154
+ end
145
155
 
146
156
  desc "Displays the status of the database migrations"
147
157
  task status: [:connection] do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequelize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenaniah Cerny
@@ -165,7 +165,9 @@ files:
165
165
  - lib/sequel/generators/migration_generator.rb
166
166
  - lib/sequel/generators/model_generator.rb
167
167
  - lib/sequel/generators/templates/application_record.rb.tt
168
+ - lib/sequel/generators/templates/down.sql.erb
168
169
  - lib/sequel/generators/templates/migration.rb.erb
170
+ - lib/sequel/generators/templates/up.sql.erb
169
171
  - lib/sequel/plugins/pretty_print.rb
170
172
  - lib/sequel/rails.rb
171
173
  - lib/sequel/rails/db_console.rb